I am using Python 3.7. I have hundreds text files containing stock price data in a parent folder. I want extract only the closing price column of each text file. Is there a way to extract only one column of each text file from the parent folder?
I'm guessing you want to extract a specific line from a text file? If so then here's your answer.
File = open('File_Name.txt')
Lines = File.readlines()
print(Lines[Choose])
Choose means what ever line you want to print out. FYI 0 is the starting line so if you replace "Choose" with 0 you will print the first line written inside that text file.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.