[Tutor] string on multiple lines
Magnus Lycka
magnus@thinkware.se
Wed Nov 13 15:20:02 2002
At 12:11 2002-11-13 -0500, Chris Kassopulo wrote:
>It is the first line of a .csv file. I read it with readlines
>and replace '\r\n' with ''.
Ok, so it contains headings for data to follow?
But comparing it with a string like that seems brittle.
I mean, if
a = '"This", "That"'
and
b = '"This","That"'
then
a == b
will be false. Is that really what you want?
Maybe you are in fact reinventing the wheel here.
Have a look at ASV, CSV or DSV, mentioned here:
thinkware.se/cgi-bin/thinki.cgi/UsefulPythonModules
>but this doesn't work because of the leading spaces:
> tst_string='"Series",\
> "Denomination",\
> "Serial Number",\
> "Issue Date"'
As I wrote before (I think?), you need leading and
trailing ' on each line.
tst_string='"Series",'\
'"Denomination",'\
'"Serial Number",'\
'"Issue Date"'
--
Magnus Lycka, Thinkware AB
Alvans vag 99, SE-907 50 UMEA, SWEDEN
phone: int+46 70 582 80 65, fax: int+46 70 612 80 65
http://www.thinkware.se/ mailto:magnus@thinkware.se