Learn
File Input/Output
Try It Yourself

It worked! Our Python program successfully wrote to text.txt.

Instructions

1.

Now you try: write any data you like to a file called text.txt using withas. Give your file object the usual name: my_file.

Folder Icon

Take this course for free

Already have an account?