5. File Handling
Quick search
code
Show Source
The Workbook for Programming with Python for Engineers
Table Of Contents
  • 1. Dive into Python
    • 1.1. Debt
    • 1.2. Varying Debt
    • 1.3. Division
    • 1.4. Exercise: Greetings
    • 1.5. Exercise: Headphones
    • 1.6. Exercise: Conflict of Metrics
    • 1.7. LCD Shipment
    • 1.8. Exercise: Jogging at Devrim
    • 1.9. Tiling the Floor
    • 1.10. Exercise: Tiling the Floor with Minimum Tiles
    • 1.11. Movie Festival
    • 1.12. Exercise: Circle and Sphere
    • 1.13. Reflection Point
    • 1.14. Exercise: BMI
    • 1.15. Exercise: Distance between Circles
    • 1.16. Cube Extraction
    • 1.17. Pool
    • 1.18. Exercise: Django
    • 1.19. Vector
    • 1.20. Slogan
    • 1.21. Exercise: Grading in CENG314
    • 1.22. Exercise: Fuel Tank
    • 1.23. Tuples and Lists
    • 1.24. Inner Elements
    • 1.25. Lego
    • 1.26. Dictionaries
    • 1.27. Exercise: Minimum and Maximum of Three
  • 2. Conditional and Repetitive Execution
    • 2.1. Letter Grade
    • 2.2. Even or Odd
    • 2.3. Ticket Price
    • 2.4. Orders from Abroad
    • 2.5. Winner Team in Board Game
    • 2.6. Apple Tree Garden
    • 2.7. Exercise: New Apple Garden Tree
    • 2.8. Repeated Strings
    • 2.9. Exercise: Office Olympics
    • 2.10. Exercise: Good Old Tiling
    • 2.11. Exercise: Triangle
    • 2.12. Exercise: Fizz Buzz
    • 2.13. Binary Planet
    • 2.14. Run-length Encoding
    • 2.15. Exercise: Connect Four
    • 2.16. Obsessed Tiler
    • 2.17. Matrix Multiplication
    • 2.18. Exercise: Incomplete Data
    • 2.19. Emotional Chatbot
    • 2.20. Minesweeper
    • 2.21. Exercise: Original Minesweeper
    • 2.22. N-Queen
    • 2.23. Helping Deroro
    • 2.24. Helping Deroro Quickly
  • 3. Functions
    • 3.1. Best Food
    • 3.2. Temperature Conversion
    • 3.3. Exercise: Leslie’s Parks
    • 3.4. Discriminant Problem
    • 3.5. Exercise: Finding Median
    • 3.6. Exercise: Middle Point
    • 3.7. Sampled Average
    • 3.8. Andy’s Songs
    • 3.9. Exercise: Bankruptcy Countdown
    • 3.10. City Sushi
    • 3.11. Health Bar
    • 3.12. Exercise: Palindrome
    • 3.13. Range of
    • 3.14. Exercise: Increment List
    • 3.15. Even Number of Customers
    • 3.16. Substring Count
    • 3.17. Exercise: Reduce Number
    • 3.18. My Range
    • 3.19. Even Numbers
    • 3.20. First Non-Prime
    • 3.21. The Game of Divisors
    • 3.22. Exercise: Perfect Number
    • 3.23. Anagram
  • 4. A Gentle Introduction to Object Oriented Programming
    • 4.1. Broken Watch
    • 4.2. Kindergarten Cipher
    • 4.3. Exercise: Maximum Occurrence
    • 4.4. Reverse Left
    • 4.5. Shopping List
    • 4.6. Exercise: Arimu and Hats
    • 4.7. Is Diagonal
    • 4.8. Capitalize Sentences
    • 4.9. Exercise: Database Recovery
    • 4.10. Single Sorted Copy
  • 5. File Handling
    • 5.1. Average Weight of Deliveries
    • 5.2. Evaluate Attendees
    • 5.3. Exercise: Grade Student
    • 5.4. Cheapest Flour
    • 5.5. Exercise: Pass or Fail
    • 5.6. Delete Answers from the Exam
    • 5.7. Exercise: Database Migration
    • 5.8. Append Reverse
    • 5.9. Exercise: Dice Game
    • 5.10. Fix Operation File
  • 6. Error Handling and Debugging
    • 6.1. Send Bulk SMS
    • 6.2. Exercise: Send Bulk SMS Revisited
    • 6.3. Calculate Expenses
    • 6.4. Find Zero
    • 6.5. Exercise: Calculate Discount Averages
    • 6.6. Exercise: Errors in General
    • 6.7. Ball Game
    • 6.8. Exercise: Memento
  • 7. Scientific and Engineering Libraries
    • 7.1. Railway Statistics
    • 7.2. Olive Production
The Workbook for Programming with Python for Engineers
Table Of Contents
  • 1. Dive into Python
    • 1.1. Debt
    • 1.2. Varying Debt
    • 1.3. Division
    • 1.4. Exercise: Greetings
    • 1.5. Exercise: Headphones
    • 1.6. Exercise: Conflict of Metrics
    • 1.7. LCD Shipment
    • 1.8. Exercise: Jogging at Devrim
    • 1.9. Tiling the Floor
    • 1.10. Exercise: Tiling the Floor with Minimum Tiles
    • 1.11. Movie Festival
    • 1.12. Exercise: Circle and Sphere
    • 1.13. Reflection Point
    • 1.14. Exercise: BMI
    • 1.15. Exercise: Distance between Circles
    • 1.16. Cube Extraction
    • 1.17. Pool
    • 1.18. Exercise: Django
    • 1.19. Vector
    • 1.20. Slogan
    • 1.21. Exercise: Grading in CENG314
    • 1.22. Exercise: Fuel Tank
    • 1.23. Tuples and Lists
    • 1.24. Inner Elements
    • 1.25. Lego
    • 1.26. Dictionaries
    • 1.27. Exercise: Minimum and Maximum of Three
  • 2. Conditional and Repetitive Execution
    • 2.1. Letter Grade
    • 2.2. Even or Odd
    • 2.3. Ticket Price
    • 2.4. Orders from Abroad
    • 2.5. Winner Team in Board Game
    • 2.6. Apple Tree Garden
    • 2.7. Exercise: New Apple Garden Tree
    • 2.8. Repeated Strings
    • 2.9. Exercise: Office Olympics
    • 2.10. Exercise: Good Old Tiling
    • 2.11. Exercise: Triangle
    • 2.12. Exercise: Fizz Buzz
    • 2.13. Binary Planet
    • 2.14. Run-length Encoding
    • 2.15. Exercise: Connect Four
    • 2.16. Obsessed Tiler
    • 2.17. Matrix Multiplication
    • 2.18. Exercise: Incomplete Data
    • 2.19. Emotional Chatbot
    • 2.20. Minesweeper
    • 2.21. Exercise: Original Minesweeper
    • 2.22. N-Queen
    • 2.23. Helping Deroro
    • 2.24. Helping Deroro Quickly
  • 3. Functions
    • 3.1. Best Food
    • 3.2. Temperature Conversion
    • 3.3. Exercise: Leslie’s Parks
    • 3.4. Discriminant Problem
    • 3.5. Exercise: Finding Median
    • 3.6. Exercise: Middle Point
    • 3.7. Sampled Average
    • 3.8. Andy’s Songs
    • 3.9. Exercise: Bankruptcy Countdown
    • 3.10. City Sushi
    • 3.11. Health Bar
    • 3.12. Exercise: Palindrome
    • 3.13. Range of
    • 3.14. Exercise: Increment List
    • 3.15. Even Number of Customers
    • 3.16. Substring Count
    • 3.17. Exercise: Reduce Number
    • 3.18. My Range
    • 3.19. Even Numbers
    • 3.20. First Non-Prime
    • 3.21. The Game of Divisors
    • 3.22. Exercise: Perfect Number
    • 3.23. Anagram
  • 4. A Gentle Introduction to Object Oriented Programming
    • 4.1. Broken Watch
    • 4.2. Kindergarten Cipher
    • 4.3. Exercise: Maximum Occurrence
    • 4.4. Reverse Left
    • 4.5. Shopping List
    • 4.6. Exercise: Arimu and Hats
    • 4.7. Is Diagonal
    • 4.8. Capitalize Sentences
    • 4.9. Exercise: Database Recovery
    • 4.10. Single Sorted Copy
  • 5. File Handling
    • 5.1. Average Weight of Deliveries
    • 5.2. Evaluate Attendees
    • 5.3. Exercise: Grade Student
    • 5.4. Cheapest Flour
    • 5.5. Exercise: Pass or Fail
    • 5.6. Delete Answers from the Exam
    • 5.7. Exercise: Database Migration
    • 5.8. Append Reverse
    • 5.9. Exercise: Dice Game
    • 5.10. Fix Operation File
  • 6. Error Handling and Debugging
    • 6.1. Send Bulk SMS
    • 6.2. Exercise: Send Bulk SMS Revisited
    • 6.3. Calculate Expenses
    • 6.4. Find Zero
    • 6.5. Exercise: Calculate Discount Averages
    • 6.6. Exercise: Errors in General
    • 6.7. Ball Game
    • 6.8. Exercise: Memento
  • 7. Scientific and Engineering Libraries
    • 7.1. Railway Statistics
    • 7.2. Olive Production

5. File Handling¶

  • 5.1. Average Weight of Deliveries
  • 5.2. Evaluate Attendees
  • 5.3. Exercise: Grade Student
  • 5.4. Cheapest Flour
  • 5.5. Exercise: Pass or Fail
  • 5.6. Delete Answers from the Exam
  • 5.7. Exercise: Database Migration
  • 5.8. Append Reverse
  • 5.9. Exercise: Dice Game
  • 5.10. Fix Operation File
Previous
4.10. Single Sorted Copy
Next
5.1. Average Weight of Deliveries