On 4/28/07, James <[EMAIL PROTECTED]> wrote:
[snip]
>  username = getuser()
>  string.strip
> (username)
>  print "username is %s" % username
[snip]
>
>
> The autoconf.txt contains two lines, which first has an ip address and
> second a username. The problem I'm having is that the string.strip() doesn't
> appear to be stripping the newline off the username.
>
>
> Any ideas? If you need more information, just ask!
>
>
> James

string.strip() returns a copy of the string with whitespace removed,
it does not modify it in place. What you really want is:
> username = getuser().strip()

Someone correct me if I'm wrong, but I believe just about all
functions from the string module are deprecated. Use the methods from
the string class. As I'm assuming getuser() returns a string object,
just use the string functions on that directly.

Ian
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to