Python file handling exercises
Read and write text, CSV and binary files in Python, on problems checked by tests in your browser.
Beginner
- 543. Lines, Words and CharactersHow big is this text file, counted three ways?30 XP6 min
- 544. Longest Line in a FileWhich line of the file runs on the longest?30 XP6 min
- 560. Average Mark From a FileA teacher's mark book saved as text: what is the class average?35 XP7 min
- 563. Copy a File With Line NumbersMake a numbered copy of a file, ready to print35 XP7 min
- 572. Save Records in a Binary FileKeep a class list on disk so the program can load it next time35 XP6 min
Intermediate
- 585. Sort Lines Into Two FilesLines that begin with a vowel go one way, the rest go the other60 XP10 min
- 588. Add a Name Only OnceA club list where nobody can sign up twice65 XP12 min
- 589. Find a Record in a Binary FileLook up one student in a file full of saved records65 XP10 min
- 601. Filter a CSV Into a New FileKeep only the rows that make the cut, header and all70 XP12 min
- 605. Totals for Every ColumnAdd up every column of a spreadsheet saved as CSV70 XP12 min
Advanced
Other topics
- Python Basics
- Strings
- Lists
- Dictionaries and sets
- Loops
- Functions
- Math
- Errors and exceptions
- Modules and random
- Sorting and searching
- Two pointers
- Sliding window
- Stacks and queues
- Recursion and backtracking
- Dynamic programming
- Greedy
- Graphs
- Trees
- Bit manipulation
- Classes
- Iterators and generators
- Parsing
- Simulation
- Python idioms
- Regular expressions
- Codes and ciphers
- Working with data
- Grids and matrices
- Geometry
- Games and puzzles
- Heaps
- Data structures
Or see every challenge, with study plans, today's challenge and duels.