CP104 Lecture Notes - Lecture 13: Buxtehude

84 views7 pages
School
Course
Professor
hayjayshay and 38575 others unlocked
CP104 Full Course Notes
2
CP104 Full Course Notes
Verified Note
2 documents

Document Summary

There are files that are not string essentially ex) photos, code etc. The purpose is to lear(cid:374) ho(cid:449) to (cid:858)(cid:859)(cid:449)rite(cid:859)(cid:859) to a file a(cid:374)d (cid:858)(cid:859)read(cid:859)(cid:859) fro(cid:373) a file. It is read in order top to bottom. Going directly to where desired data is at. Working with files are broken down into 3 steps: open file, read/process file, close file. File_var is not the name of the file but rather the data that is being processed. Mode what file is opened for: reading, writing. Print({}. format(item),file = f_test) # f_test is the file name. Basically, say as formatted printing but with file=file_var at the end. Line = travel_file. readline(). strip() # reads first line before loop. While li(cid:374)e != (cid:863)(cid:863): # checks if file is not empty. Data. append(line) # adds data from line of file. Can have a condition where we can stop whenever and not read the entire file. A for loop will always read the entire file unless.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents

Related Questions