Split string data have ","

Chris Rebert clp2 at rebertia.com
Tue Jan 29 12:08:50 EST 2013


On Jan 29, 2013 9:05 AM, "moonhkt" <moonhkt at gmail.com> wrote:
>
> Hi All
>
> Python 2.6.2 on AIX 5.3
> How to using split o
>
> >>> y = '"abc.p,zip.p",a,b'
> >>> print y
> "abc.p,zip.p",a,b
> >>>
>
> >>> k= y.split(",")
> >>> print k[0]
> "abc.p
> >>>
>
> Need Result, First element is
> abc.p,zip.p

Try the csv module or the shlex module.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20130129/918f4b4b/attachment.html>


More information about the Python-list mailing list