Is there a way to delete every n bytes from one point to the first byte? This s quite confusing. What I've done:

a = open("file.txt","r")
b = a.read()
a.close()

findit = "WIN - PLACE"
texto = b.find(findit)

And now I need to delete everything before "WIN - PLACE", its like 20 lines that i have to delete. Any ideas? Thanks

Something like:

open("file.txt","w").write(b[texto:])

Oh my god. That did it. It was really easy. Thank you again ;)

Oh my god. That did it. It was really easy. Thank you again ;)

Next time you can think if the complement of the problem is easier to solve than problem you are tacling.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.