seek()

Zutroi Zatatakowski abou at cam.org
Sun Mar 31 11:24:06 EST 2002


Zutroi Zatatakowski wrote:

> # Now I have the source in a file. No problems here.
> # This finds the byte where 'Gold' starts. I know that Gold's value is
> found 8 # bytes later.
> 
> longstr = c.read()
> print string.find(longstr, 'Gold')
> # Is it possible to have the output of string.find() converted to a
> string, or even # better, to an int? If I can get the location of 'Gold'
> into an int, it would be # easy to do:

Ok, I fixed my problem, was kinda easy, I just didn't think about it:

c.seek(string.find(longstr, 'Gold'))
print c.read(10)



-- 
Zutroi Zatatakowski
Commando PACU
http://pacu.cjb.net




More information about the Python-list mailing list