



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
This is introductory course for computer science. Its about basic concepts involving in computer programming, structure and working. Key points in this lecture handout are: File Input, Programs Often Take Input from a File, a Simple Echo Program, Another Gotcha
Typology: Study notes
1 / 6
This page cannot be seen from the preview
Don't miss anything!




Today
Reading
Homework
Programs often take input from a file
A simple echo program
When this runs ...
Close files when done with them
the_file = open(’test.txt’) ... do stuff ... the_file.close()
Each line is considered a string
10 20 30 40 50 60
the_file = open("nums.txt") for line in the_file: num = int(line) print(num)