[Tutor] Suggestions Please
Alan Gauld
alan.gauld at btinternet.com
Wed Oct 8 08:49:21 CEST 2014
On 08/10/14 02:02, Phillip Pugh wrote:
> with open("InputTest.txt","r") as f:
> with open("Outputt.txt", "w") as fw:
> for line in f:
> first,second = line[:32], line[32:37]
>
> if first.isspace()== False:
> fw.write (second.strip()+ first.strip()+"\n")
>
> f.close()
> fw.close()
>
>
You don't need the close()s
the with construct does that for you automatically.
Alan G.
More information about the Tutor
mailing list