Files

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