To Lecture Notes

IT 211 -- Jan 30, 2019 -- Makeup Lecture Notes

Review Exercises

  1. Write a statement that opens the file input.txt for reading; name the file object fin. Ans:
    fin = open("input.txt", "r")
    
  2. Write a statement that opens the file out.txt for writing; name the file object fout. Ans:
    fin = open("out.txt", "w")
    
  3. Write a statement that reads line from the input file accessed by the file object fin. Ans:
    line = fin.readline( )
    
  4. Write a statement that writes a string s to the output file accessed by the file object fout. Ans:
    fout.write(s)
    
  5. Write a statement that closes the file object fout. Ans:
    fout.close( )
    

Examples Zipfile

Sequential Processing

Extracting Fields from a Line

Employee Examples