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. Append to file
  17. Binary mode
  18. Does file exist? Is it a file?
  19. Direct access of a line in a file
  20. Exercise: count digits
  21. Exercise: remove newlines
  22. Exercise: print lines with Report:
  23. Exercise: color selector
  24. Exercise: ROT13
  25. Exercise: Combine lists
  26. Exercise: Number guessing game - save to file
  27. Solution: count numbers
  28. Solution: remove newlines
  29. Solution: print lines with Report:
  30. Solution: color selector
  31. Solution: ROT13
  32. Solution: Combine lists
  33. Solution: Combine lists with tuple
  34. Filehandle using with and not using it