Changes

Jump to: navigation, search

OPS435 Python Lab 5

4 bytes added, 15:57, 4 September 2017
PART 1 - Reading Data From Files
Third line
Last line
</source><br><br>In order to read data from a text file, we need to create a special storage area (or a "buffer") that will be used to access and storage the data in a file. This special storage has different names for various programming languages (like a '''"file pointer"''' in the C programming language or as an '''"object"''' in object oriented programming languages). In Python, we define an '''object''' to store the retrieved data. To simplify things for now, you can think of an '''object''' as a '''special variable'''. You will learn more about object oriented programming later in this lab.<br><br>
:#Now lets practic some python code from the ipython3 prompt to open this file for reading.<source lang="python">
f = open('data.txt', 'r')
13,420
edits

Navigation menu