split problem if the delimiter is inside the text limiter
tino at wildenhain.de
Wed Mar 18 13:11:36 CET 2009
> I had a problem, i would like to process a file into a PSQL, but in
> the file the delimiter char is ':'
> and i have the same charater inside the text field also.
> something like this:
> text = 1:23:34:"sample: text":" something"
> if I use text.split(':')
> it will be ['1', '23', '34', '"sample', 'text"', 'something']
> but it's not good for me, because the delimiter is in text limiter "
> is it a solution, that is fast to process ? so i don't need to split
> by "hand made" function
You should check out the csv module, you can define quote char and
delimiter and this should just work.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 3241 bytes
Desc: S/MIME Cryptographic Signature
More information about the Python-list