scrivere file

Christian Gollwitzer auriocus at gmx.de
Sun Feb 12 15:38:44 EST 2017


Am 12.02.17 um 21:19 schrieb Paolo:
> Buonasera, è da un pò che sto cercando come esercizio di scrivere un
> file al contrario.
> Mi spiego meglio ho un file con N righe e vorrei scriverne un altro con
> gli stessi dati ma la 1° riga deve diventare l' ultima.
> Es. file di partenza
> riga1
> riga2
> riga3
> riga4
>
> file riscritto
>
> riga4
> riga3
> riga2
> riga1
>
> Grazie anticipamente per i consigli


  tac <file1 >file2

does that. You need to read the whole file into memory and print the 
lines in reversed order.

BTW, this is an English group. Your question is clearly stated and 
therefore can be understood with minimal knowledge of Italian, but be 
prepared to discuss it in English in the following.
	
	Christian



More information about the Python-list mailing list