1price = 33.3
2with open("Output.txt", "w") as text_file:
3 text_file.write("Purchase Amount: %s price %f" % (TotalAmount, price))
4
1price = 33.3
2with open("Output.txt", "w") as text_file:
3 text_file.write("Purchase Amount: %s price %f" % (TotalAmount, price))
1>>> with open('workfile') as f:
2... read_data = f.read()
3
4>>> # We can check that the file has been automatically closed.
5>>> f.closed
6True
7