rudnik
unread,Aug 26, 2011, 11:28:58 AM8/26/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to shedskin-discuss
writes.py:
linia=[]
def zapisz():
plik=file(nazwa,"w")
for line in linia:
plik.write(line)
del plik
def czytaj():
del linia[:]
plik=file(nazwa)
for line in plik.readlines():
if line!="\n" and line!="\r" and line!="\r\n":
linia.append(line)
del plik
nazwa="plik.txt"
czytaj()
linia+=["l1","l2","l3"]
zapisz()
czytaj()
linia+=["asdf"]
zapisz()
plik.txt:
text1
If I use CPython, I get in plik.txt:
tekst1
l1l2l3asdf
If I use Shedskin version of my program, I get in plik.txt:
tekst1
l1l2l3