| Author |
Message |
sisifos Grasshopper
Joined: 01 Aug 2007 Posts: 1 Location: Groningen
|
Posted: Wed Aug 01, 2007 10:55 am Post subject: CR to LF conversion help needed |
|
|
Hello all,
I am building a data analysis application and i am facing problems to read my data files in different platforms. Originally the text data files are created by an old labview version running on an old mac with macos9 (as far as i can see these text files use only CR as a new line character)
My software is build and runs on python 2.4.4 (running Kubuntu linux) but every time i have to analyze my data i have to manually convert CR to LF with a text editor (i use the tex edit plus on macosX manually converting files one by one then transfering to a usb stick then transfering files to the linux running pc.. ....way to much work...).
The question is how can i search and find for carriage returns in my file and convert them to line feeds (or CR + LF for further use in windows).
I did a bit of searching around but haven't managed to find anyhtong really usefull
Can somebody suggest anything??? |
|
| Back to top |
|
 |
WannaBe Wiggles
Joined: 22 Oct 2004 Posts: 714 Location: CA
|
Posted: Fri Aug 03, 2007 1:25 am Post subject: |
|
|
You could do a string replacement when loading the file in python.
http://www.devshed.com/c/a/Python/String-Manipulation/
Simply replace crlf (13 & 10) to lf (10), then cr (13) to lf (10).
This would make sure you convert Windows' crlf to Linux's lf, then also spare cr(s) to lf(s). |
|
| Back to top |
|
 |
|