Lesson goal: Reading from a data file

Previous: Introduction to data files | Home | Next: Reading all data from a file (1)

In the last lesson, you learned how to open a file. Now, let's learn how to read in some data contained in the file.

To read data from a file, you can used the file_read function, that works like this:
Move the mouse over a dotted box for more information.

Now you try. Run the code and see if you can read the first line of data from the file sample.dat.

Type your code here:

See your results here: