Files

  1. File types: Text vs Binary
  2. Open vs. Read vs. Load
  3. Binary files: Images
  4. Reading an Excel file
  5. Open and read file (easy but not recommended)
  6. Open and read file using with (recommended)
  7. Read file remove newlines
  8. Filename on the command line
  9. Filehandle with return
  10. Read all the lines into a list
  11. Read all the characters into a string (slurp)
  12. Not existing file
  13. Open file exception handling
  14. Open many files - exception handling
  15. Writing to file
  16. Print to file
  17. Append to file
  18. Binary mode
  19. Does file exist? Is it a file?
  20. Direct access of a line in a file
  21. Exercise: count digits
  22. Exercise: remove newlines
  23. Exercise: print lines with Report:
  24. Exercise: color selector
  25. Exercise: ROT13
  26. Exercise: Combine lists
  27. Exercise: Number guessing game - save to file
  28. Solution: count numbers
  29. Solution: remove newlines
  30. Solution: print lines with Report:
  31. Solution: color selector
  32. Solution: ROT13
  33. Solution: Combine lists
  34. Solution: Combine lists with tuple
  35. Filehandle using with and not using it