Home > other >  How python binary character location
How python binary character location

Time:09-19

As title, there are a binary file, utf-8
Use beyond compare can see some keywords

How to write a judgement, start from the axial force began to read data,
Please big under the guidance of the

CodePudding user response:

You need to decide what?

CodePudding user response:

This mean?
 key="hello" 
With the open (r "c: \ TEST. TXT", 'rb') as f:
C, the chunk, the begin='a', 0, 0
L=[]
While c!=' ':
F.s eek (the chunk)
C=STR (f.r ead (1)) [: - 1]. The replace (" b ", ")
If the begin & lt; Len (key) and c==key (begin) :
L.A. ppend ([c, the chunk])
The begin +=1
The else:
If the begin==len (key) :
F.s eek (l [0] [1])
N=f.r ead ()
With the open (r "c: \ TESTnew TXT", 'wb) as ff:
Ff. Write (n)
Break
The else:
L.c Lear ()
The begin=0

The chunk +=1

CodePudding user response:

refer to the second floor chuifengde response:
this mean?
 key="hello" 
With the open (r "c: \ TEST. TXT", 'rb') as f:
C, the chunk, the begin='a', 0, 0
L=[]
While c!=' ':
F.s eek (the chunk)
C=STR (f.r ead (1)) [: - 1]. The replace (" b ", ")
If the begin & lt; Len (key) and c==key (begin) :
L.A. ppend ([c, the chunk])
The begin +=1
The else:
If the begin==len (key) :
F.s eek (l [0] [1])
N=f.r ead ()
With the open (r "c: \ TESTnew TXT", 'wb) as ff:
Ff. Write (n)
Break
The else:
L.c Lear ()
The begin=0

The chunk +=1

Thank you, I have been resolved, you can use the found, will be a little bit more simple, code is not so much

CodePudding user response:

reference 1st floor chuifengde response:
you need to decide what?

No, I have to solve
  • Related