#!/usr/bin/python
#Eseguire come
#
#python lpte.py nuovo_file_da_creare.txt
import sys
__prog__ = "LPTE - Linear Python Txt Editor"
__version__ = "1.0"
__author__ = "balloto"
__site__ = "http://www.pierotofy.it"
print __prog__ + " " + __version__
print "(digita END per scrivere il file ed uscire)"
print "(o ENDN per uscire senza scrivere il file)\n"
righe=list()
def editor(testo):
while(True):
linea = str(raw_input(""))
if linea == "END":
f = open(testo, 'w+')
for scritte in righe:
f.write(str(scritte + "\n"))
f.close()
return False
elif linea == "ENDN":
return False
else:
righe.append(linea)
if __name__ == '__main__':
try:
editor(sys.argv[1])
except IndexError:
print "Devi inserire il nome del nuovo file TXT da creare"
print "Ex: editorlineare nuovodoc.txt"