16. Python Chapter 5 — strings and text files - revision mindmap
All mindmaps · Full chapter · Practice answers

Open full-resolution image · Printable collection - page 16
The map is a completed revision summary. Cover a branch and reconstruct it, then try the linked chapter practice. Read the image at full size when labels are small.
Text version
String model
- Immutable sequence of characters
- Positive and negative indices
- Slice start/stop/step; stop excluded
- Index out of range versus forgiving slice bounds
String operations
- Case conversion and replacement return new values
- find: position 0 succeeds; −1 absent
- split with separator versus whitespace split
- strip/rstrip and join; retain meaningful spaces
Representation and comparison
- Text identifier preserves leading zeroes
- Lexicographic versus numeric order
- ord/chr and character processing
- isdigit is broader than ASCII digits
File interface
- r reads; w creates/truncates; a appends
- read, readline and readlines
- Empty string at EOF versus blank line
- with closes file; write needs explicit newline
Read-process-write
- Establish format, header and delimiter rules
- Skip only permitted blank records
- Parse text and convert numeric fields
- Accumulate result; format and save exact output
Worked example & exam traps
- ‘Ann,17\n’ → rstrip(‘\n’) → split(’,’) → [‘Ann’,‘17’].
- int(fields[1]) → 17. write(‘Ann,18\n’) saves the newline explicitly.
- readline() returns ” at EOF; a blank line can be ‘\n’.
- Avoid: line[:-1] blindly; split comma for unrestricted quoted CSV
Sources and reading
This map condenses Chapter 16 and its source trail. Use the self-learning reading guide for the corresponding VJC pages and A notes. It does not add topics to the stated promo scope.