caratteri.py convertito in python 3

This commit is contained in:
Daniele Lacamera 2019-12-25 19:42:52 +01:00
parent 662be040c7
commit ed165502e7

View file

@ -11,13 +11,13 @@ mappa_caratteri = [
] ]
caratteri_python_a_elea = { caratteri_python_a_elea = {
char.decode('utf-8'): idx char : idx
for idx, char in enumerate(mappa_caratteri) } for idx, char in enumerate(mappa_caratteri) }
def stringa_python_a_elea(string): def stringa_python_a_elea(string):
s = [] s = []
for i in string.decode('utf-8'): for i in string:
if i in (' ', '\n'): if i in (' ', '\n'):
continue continue
@ -72,8 +72,8 @@ if __name__ == '__main__':
try: try:
nomefile = sys.argv[1] nomefile = sys.argv[1]
except: except:
print "converte da txt in elea -> file c\n" print ("converte da txt in elea -> file c\n")
print "usaggio: %s nomefile.txt" print ("usaggio: %s nomefile.txt")
sys.exit() sys.exit()
converti(nomefile) converti(nomefile)