Re: Split string data have ","

2013-01-29 Thread moonhkt
On Jan 30, 1:08 am, Chris Rebert wrote: > On Jan 29, 2013 9:05 AM, "moonhkt" 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

Re: Split string data have ","

2013-01-29 Thread Chris Rebert
On Jan 29, 2013 9:05 AM, "moonhkt" 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 modul

Re: Split string data have ","

2013-01-29 Thread Tim Chase
On Tue, 29 moonhkt wrote: > >>> 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 The csv module should handle this nicely: >>> import csv >>> y = '"abc.p,zip.p",a,b' >>>