>Try opening the file in 'rbU' mode. This will use universal newline mode
>and convert all carriage returns to line feeds.
I tried this, but as you say, now there are 0x0A bytes extra in my
files, is there also a possibility to let all these things out, and
just get the file.
I am working on a sc
Farshid Lashkari wrote:
> > I am working on a script to get parts of raw data out of a file, and
> > the data I read has to be the data written in the file without CR or
> > LF.
>
> So you just want to remove all the linefeeds? This should work then:
>
> data = data.replace('\n','')
>
> -Farshid
f = open('myfile,'r')
a = f.read(5000)
When I do this I get the first 634 bytes. I tried using the:
f = open('myfile,'rb')
option, but now there are a few 0x0D bytes extra in myfile. 0x0D =
Carriage return. How can I make a program that not puts in the 0x0D
bytes in windows.
In linux the first 2
>if it's a binary file, open with mode "rb".
You are right about opening it in the rb mode (flaw in the start post),
but also when I do this in windows in front of every 0x0A is put a
0x0D. I found a explanation why it is working in linux it is below in
my post.
But what i get of this that in wind
I have the solution, the flaw was not in the opening of the file, but
in the writing of the file. Stupid me, i opened it with mode rb, but
wrote it with w instead of with wb
Everybody thanks for helping me.
--
http://mail.python.org/mailman/listinfo/python-list
Ik have an uml file I want to read with readlines. I have the following
code:
infile = open("out2.txt","r")
for line in infile.readlines():
print line
The print statement just gives the data, not the uml headings. Is there
a solution which also gives the uml headings.
--
http://mail.python.o
Sorry it is so hot in here, I make mistakes, I meant it to be an xml
file. But still sthe same problem
wscrsurfdude wrote:
> Ik have an xml file I want to read with readlines. I have the following
> code:
> infile = open("out2.txt","r")
> for line in infile.readl