> 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.
Try opening the file in 'rbU' mode. This will use
"wscrsurfdude" wrote:
> >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.
>
On Fri, 17 Feb 2006 00:15:31 -0800, wscrsurfdude wrote:
>
> 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
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
>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
"wscrsurfdude" wrote:
> >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 g
> 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
--
http://mail.python.org/mailman/listi
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
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
>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
10 matches
Mail list logo