for loop over indices
Parellel Lists and Strings Nested Loops - In general, the number of iterations of a nested loop over lists will be
the product of the lengths of the lists.
Reading Files
to open file open(filename, mode) mode 'r' - to open for reading 'w' - to open for writing (erasing what is already in the file) 'a' - to open for appending (adding to what is already in the file) Method readline() readline() read and return the next line from the file, including the newline character (if it exists) return the empty string if there are no more lines in the file. The readline approach 1. use readline to s ip the beginning of the file !. read the first line of the file you are interested in ". while not at the end of the interesting section# process the current line read the next line of the interesting section WHen to use this approach $hen you want to process only some parts of a file. The for line in file approach for line in file# process line When to use this approach $hen you want to process every line in a file
The read approach file.read() When to use this approach - $hen you want to read the whole file at once. The readlines approach list % file.readlines() When to use this approach - $hen you want to be able to examine each line by index. Method write(str) - $rite a string to a file. (unli e function print, this does not append an extra newline character.) Module tkinter &ontains types and functions for creating graphical user interfaces Module tkinter.filedialog - &ontains functions for creating dialogs Developing a rogram