Hello, im begginer in python. I have a problem with cycle.
i have text.txt
work.py
Please help me, i working on it all night... :) Thank you
i have text.txt
Quote:Text
The text denotes any combination of words that together make a statement.
Mostly, however, the text is denoted by some separate or paragraph.
The word text is used for written statements.
Books are labeled as artistic texts, newspaper articles as publicity texts,
work.py
import os import sys cesta_vstup_rel = 'text.txt' cesta_vystup_rel = 'text_vystup.txt' if not os.path.exists(cesta_vstup_rel): print 'vstupni soubor nenalezen!' sys.exit() vstup = open(cesta_vstup_rel, 'r') radky = vstup.readlines() vstup.close() zapis = open(cesta_vystup_rel, 'w') #oteviram soubor pro zapis (w-write) for radek in radky: zapis.write(radek.strip('\n') + '[b]number of characters[/b]') zapis.close()i need make numbers of all characters on end of line, like this:
Quote:Text4
The text denotes any combination of words that together make a statement.73
Mostly, however, the text is denoted by some separate or paragraph.67
The word text is used for written statements.45
Books are labeled as artistic texts, newspaper articles as publicity texts,75
Please help me, i working on it all night... :) Thank you