python lists and newline character
Stephen Johnson
diordna at gmail.com
Mon Jul 28 13:38:43 EDT 2008
domain.strip()
Assuming domain is the string with the newline.
-Steve Johnson
On Jul 28, 2008, at 1:32 PM, Support Desk wrote:
> Hello all,
> I am using os.popen to get a list returned of vpopmail
> users, something like this
>
> x = os.popen('/home/vpopmail/bin/vuserinfo -n -D
> mydomain.com).readlines()
>
> x returns a list, of usernames, and I am trying to append the
> usernames with the domain like so
>
> for line in x:
> print line + ‘@’ + domain
>
> but instead of getting
>
> user at domain.com
>
> im getting a newline character like:
> user
> @domain.com
> User
> @comain.com
> User2
> @domain.com
>
>
> Is there some way I can get this list without the newline characters
> being added. or somehow remove the newline characters. Any help
> would be appreciated.
> --
> http://mail.python.org/mailman/listinfo/python-list
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20080728/2a8a9742/attachment-0001.html>
More information about the Python-list
mailing list