does not work output in Output.txt, IDE gives an error
ouf.write (result) io.unsupportedoperation: not writable
Code:
with open ('dataset_3363_2.txt') AS INF:
DNK = inf.ReadLine ()
RESULT = ''
i = 0.
KOL = 0.
Let = ''
While I! = (Len (DNK) - 1):
IF NOT ('0' & lt; = dnk [i] & lt; = '9'):
For j in Range (0, KOL):
Result + = Let
Let = DNK [i]
KOL = 0.
ELSE:
BUF = STR (KOL) + DNK [i]
KOL = INT (BUF)
I + = 1
For i in Range (0, KOL):
Result + = Let
With Open ('Output.txt') AS OUF:
OUF.WRITE (RESULT)
Answer 1, Authority 100%
You need to explicitly specify that you open the file to write:
with open ('output.txt', 'w') as ouf:
OUF.WRITE (RESULT)