Thanks, that helped.  I took a second look and realized where I had tried calling the .strip() method was wrong.  Appreciate the pointer.<div><br>Becky <br><br><div class="gmail_quote">On Thu, Mar 3, 2011 at 5:37 PM, Kushal Kumaran <span dir="ltr">&lt;<a href="mailto:kushal.kumaran%2Bpython@gmail.com">kushal.kumaran+python@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="im">On Fri, Mar 4, 2011 at 6:48 AM, Becky Mcquilling &lt;<a href="mailto:ladymcse2000@gmail.com">ladymcse2000@gmail.com</a>&gt; wrote:<br>

&gt; I am creating a dictionary by parsing a text file.<br>
&gt;<br>
&gt; The code is below:<br>
&gt; backup_servers = {}<br>
&gt; fo = open(&#39;c:/test/backup_shares.txt&#39;)<br>
&gt; for line in fo:<br>
&gt;   backup_server = line.split(&#39;,&#39;)<br>
&gt;   backup_servers[backup_server[0]]=backup_server[1]<br>
<br>
</div>Looping over a file object returns lines including the trailing<br>
newline.  If that&#39;s not required, you have to remove the newline at<br>
the end yourself using the strip method.<br>
<br>
To see the behaviour, print out the value of line at the start of the loop body.<br>
<br>
Documentation on file objects:<br>
<a href="http://docs.python.org/library/stdtypes.html#file-objects" target="_blank">http://docs.python.org/library/stdtypes.html#file-objects</a><br>
Documentation on strings:<br>
<a href="http://docs.python.org/library/stdtypes.html#string-methods" target="_blank">http://docs.python.org/library/stdtypes.html#string-methods</a><br>
<br>
&gt; &lt;snip&gt;<br>
<br>
--<br>
regards,<br>
<font color="#888888">kushal<br>
</font></blockquote></div><br></div>