Uwe: That is what I was expecting, but I do not get that. I am writing the string to a file. When I view the file I get astr, not the two records separated by the return.
f = open('text.txt', 'w') f.write(astr) yields one string in the file and not two records. Jeff Jeff Johnson [EMAIL PROTECTED] SanDC, Inc. 623-582-0323 Fax 623-869-0675 Uwe Grauer wrote: > Jeff Johnson wrote: >> I have an import process that takes variable length fields that include >> spaces delimited by spaces in an ascii stream sprinkled with new lines. >> I read the file into a string and then split it delimited by spaces >> into a list and then clean it up looking for various templates in the >> data. The hard part was easy in Python and it will clean up a >> relatively large file with blinding speed! I have written the same >> routine in VFP and it takes considerably longer. That may not surprise >> you guys, but it surprised me. >> >> The problem I am having is that when I convert the list back into a >> string to write it to a file, I am trying to write a record of data with >> a new line at the end. My string looks sort of like this: >> >> "'field','field','\n','field','field','\n'" >> >> I can't seem to be able to get the '\n' to work as a new line. I can't >> count bytes because the fields are all variable length. >> >> Any assistance will be appreciated. >> > > Please explain! > When i do: > astr = "'field','field','\n','field','field','\n'" > print astr > i get: > 'field','field',' > ','field','field',' > ' > Isn't that what you want to get? > > Uwe > > [excessive quoting removed by server] _______________________________________________ Post Messages to: Dabo-users@leafe.com Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users Searchable Archives: http://leafe.com/archives/search/dabo-users This message: http://leafe.com/archives/byMID/dabo-users/[EMAIL PROTECTED]