Scusate non capisco. Ho creato questo programma filePath = "open_file.py" buffer = "Lettura completa:\n" buffer += open(filePath, 'rU').read() print buffer
buffer = "Lettura riga per riga:\n" inList = open(filePath, 'rU').readlines() print inList for line in inList: buffer += line print buffer buffer = "Lettura di bytes:\n" file = open(filePath, 'rU') while(1): bytes = file.read(5) if bytes: buffer += bytes else: break print buffer da IDLE mi funziona perfettamente ma da terminale (linux) mi da questo errore luigi@luigi-300E4C-300E5C-300E7C:~/Programmi$ python3 read_file1.py File "read_file1.py", line 4 print buffer ^ SyntaxError: invalid syntax Come mai ? Non dovrebbe essere un errore di sintassi.
_______________________________________________ Python mailing list Python@lists.python.it http://lists.python.it/mailman/listinfo/python