Python uses the file data type to work with files on your computer or on the Internet. Note that the file type is not the same as the actual file. The file type is Python's internal representation of a computer or Internet file.

REMEMBER Before Python can work with an existing file or a new file, you need to open the file inside Python.

This example opens a file called myfile:


You can do a lot with files in Python. Check out Part IV to find out more. Data types have methods

In Python, each data type has built-in actions associated with it, which let you do various things with the data. These actions are called methods. Methods are tailored to work efficiently with their particular data types.

Was this article helpful?

0 0

Post a comment