+ 1
How to read file in python
I want to read each line from a .txt file and able to to access each word in a line with their index positions. there are two words in each line, words are separated with a tab space. Thanks u
3 Answers
+ 4
To open a file in python, you can use the built in 'open()' function
Here's the basic syntax:
file = open('filename.txt', 'r')
Where the second parameter is the mode the file is open in. For more information, I recommend taking a look at this:
https://www.w3schools.com/python/ref_func_open.asp
+ 1
thank you Brian R
lemme check out the link