Ingo 'resISt' Siebert
res1st at gmx.de
Fri Feb 9 23:17:03 CET 2001
i´m very new to Python but i have to learn that. So i´m starting with litte
programs but i have now a big problem.
I have (Win-)Files which contains something like
fjioejfejfkljklTCHAT "Blablabla" kfoefeisdfidjsfmiosdf...TCHAT "Blablabla"
(tchat are also in low letters)
So i want to replace all Blablabla's with a some chars (i did choose *)
So it should look like
fjioejfejfkljklTCHAT "*********" kfoefeisdfidjsfmiosdf
So I wrote the following Program.
filea = os.stat('c:/tmp/test.dat')[ST_SIZE]
print "Filesize:" , filea , "Bytes"
print "Please wait..."
while fpos < filea:
if fstr == 'tchat':
print "tchat found"
while fstr2 != ssign :
print fstr2, "-> *"
if i > 200 :
print "Error: someone said too much"
fpos = fpos+1
I also use the following at the beginning.
import os, sys
from stat import *
I don´t know if i really need them both, but i will try it later. :)
Now my Problem. If i start my program then it seems that all is working.
the chars which sould be replaced are listet correct on my screen
X -> *
Y -> *
But my file is still the old one, nothing were replaced.
Why does this
nothing do to my file?
And after my program is halted, my Test-File is still in use, said Windows
when i wanted to modify it. Is
It would be great if you could help me.
More information about the Python-list