222k views
2 votes
Write a line of code that will open a file (data.txt) to read. The file object is nameData (python)

1 Answer

7 votes

Answer:

To open the file (data.txt) to read in Python, use this command:

nameData = open('data.txt', 'r')

This will create a file object called nameData, which can then be used to access the contents of the file.

Step-by-step explanation:

User Jake Boomgaarden
by
7.5k points