removing characters before writing to file

Frank Potter could.net at gmail.com
Wed Feb 8 22:31:23 EST 2006


r=re.compile(r"(\(')|( '\))|'")
print r.sub('',str(output))

On 8 Feb 2006 18:35:01 -0800, eight02645999 at yahoo.com <
eight02645999 at yahoo.com> wrote:
>
> hi
> i have some output that returns a lines of tuples egtr
>
> ('sometext1', 1421248118, 1, 'P ')
> ('sometext2', 1421248338, 2, 'S ')
> and so on
> ....
>
> I tried this
> re.sub(r" '() ",'',str(output)) but it only get rid of the ' and not
> the braces. I need to write the output to a file such that
>
> sometext1, 1421248118, 1, P
> sometext2, 1421248338, 2, S
>
> I also tried escaping , re.sub(r" '\(\) ",'',str(output)) but also did
> not work
> How can i get rid of the braces before writing to file? thanks
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20060209/583b9a20/attachment.html>


More information about the Python-list mailing list