Python - File IO: Opening & Writing Basics

Published on 12 April 2022 at 01:19

An introduction to opening and writing to files in Python.

Download this code: GitHub

Program Run-Through

Section 1

Section 1.1: Directory before outFile = open(“out_numbers.txt”, “w”) is run.

Section 1.2: Directory after outFile = open(“out_numbers.txt”, “w”) is run

Section 1.3: out_numbers.txt file at end of section 1.

Section 2

Section 2.1: Result of printing fileObject Attributes

Section 3

Section 3.1: out_numbers.txt after section 3 is run

Further Reading


«