Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #34661
| References | <37e2ba70-a709-4888-9672-be30956d690d@googlegroups.com> |
|---|---|
| Date | 2012-12-11 17:53 -0500 |
| Subject | Re: Problem with print and output to screen |
| From | Joel Goldstick <joel.goldstick@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.754.1355266426.29569.python-list@python.org> (permalink) |
[Multipart message — attachments visible in raw view] - view raw
When you read the file line by line the end of line character is included
in the result
try user[:-1] instead to strip the return from your printed text
On Tue, Dec 11, 2012 at 5:31 PM, Mike <miguelcoam@gmail.com> wrote:
> Hello, I am learning python and i have the next problem and i not
> understand how fix.
> The script is very simple, shows in the terminal the command but, the row
> is divided in two:
> Example:
>
>
> /opt/zimbra/bin/zmprov ga user@example.com
> |egrep
> "(zimbraPrefMailForwardingAddress:|zimbraPrefMailForwardingAddress:)"
> /opt/zimbra/bin/zmprov ga user2@example.com
> |egrep
> "(zimbraPrefMailForwardingAddress:|zimbraPrefMailForwardingAddress:)"
>
> And the correct is:
> /opt/zimbra/bin/zmprov ga user@example.com |egrep
> "(zimbraPrefMailForwardingAddress:|zimbraPrefMailForwardingAddress:)"
>
>
> The script is:
>
> #!/usr/bin/python
> import os
>
> for user in open ("email"):
> print '/opt/zimbra/bin/zmprov ga ' + user + '|egrep
> "(zimbraPrefMailForwardingAddress:|zimbraPrefMailForwardingAddress:)" '
>
>
>
> Thanks
> --
> http://mail.python.org/mailman/listinfo/python-list
>
--
Joel Goldstick
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Problem with print and output to screen Mike <miguelcoam@gmail.com> - 2012-12-11 14:31 -0800
Re: Problem with print and output to screen Dave Angel <d@davea.name> - 2012-12-11 17:48 -0500
Re: Problem with print and output to screen Joel Goldstick <joel.goldstick@gmail.com> - 2012-12-11 17:53 -0500
Re: Problem with print and output to screen Dave Angel <d@davea.name> - 2012-12-11 18:00 -0500
Re: Problem with print and output to screen Joel Goldstick <joel.goldstick@gmail.com> - 2012-12-11 18:07 -0500
Re: Problem with print and output to screen Mike <miguelcoam@gmail.com> - 2012-12-11 16:44 -0800
Re: Problem with print and output to screen Mike <miguelcoam@gmail.com> - 2012-12-11 16:44 -0800
csiph-web