CSC108H1 Lecture Notes - Lecture 7: Gnu Readline, Empty String, Tkinter
65 views2 pages
yifanyang and 39659 others unlocked
21
CSC108H1 Full Course Notes
Verified Note
21 documents
Document Summary
Open files: open(filename, mode: r : reading, w : writing (erasing what is already in the file, a : appending (adding to what is already in the file) Save file under a variable so that it is easier to call. Read: file. read( ) [ want to read the whole file at once] Readlines: list = file. readlines ( : for line in lines, when you want to be able to examine each line by index print(line, end = ) Writes a string to a file: module tkinter: contains types and functions for creating graphical user interfaces, module tkinter. filedialog: contains functions for creating file dialogs. Immutable sequences (cannot be changed); can be indexed and sliced (expr1, expr2, expr3); for 1 element tuples: (expr1,) {key1: value1, key2: value2, , keyn: valuen} key in filename [will return true/false; error if you try value in filename] Keys must be unique, values may be duplicated. To remove a key, use del filename.
Get access
Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers