From charlesreid1

(Created page with "=Chapter 6: File Processing= Sections: 6.1 File reading basics 6.2 Token based processing 6.3 Line based processing 6.4 Advanced file processing 6.5 Case study: zip code...")
 
Line 20: Line 20:


(Python makes this a dream.)
(Python makes this a dream.)
<pre>
with open('data.txt','r') as f:
    lines = f.readlines()
</pre>
Done.


=Flags=
=Flags=


{{CSC142Flag}}
{{CSC142Flag}}

Revision as of 10:18, 1 September 2016

Chapter 6: File Processing

Sections:

6.1 File reading basics

6.2 Token based processing

6.3 Line based processing

6.4 Advanced file processing

6.5 Case study: zip code lookup

Chapter 3 focused on a scanner for user input. Chapter 6 focuses on a scanner for file reading.

Many intro programming classes see this as a complicated topic, and Java doesn't make it easy. It's awkward, but it's manageable.

We will also explore exceptions relate to file processing.

(Python makes this a dream.)

with open('data.txt','r') as f:
    lines = f.readlines()

Done.

Flags