I am trying to extract some data from a text file. Those are the line of code:
directory = './mydirec'
files = glob('{0:s}/*.gather.txt'.format(directory))
I keep receiving [] , so no results. Someone can help me to understand why? Thanks
I am trying to extract some data from a text file. Those are the line of code:
directory = './mydirec'
files = glob('{0:s}/*.gather.txt'.format(directory))
I keep receiving [] , so no results. Someone can help me to understand why? Thanks
Copyright © 2021 Jogjafile Inc.
Perhaps I misunderstand your question, but gathering data from a .txt is really really easy. You can open and read a text file with 3 or 4 lines of code:
and if you're looking for data from specific lines of a .txt you can use:
or if you want to look for a specific piece of data in a text file in general
I don't believe you have to mess with .format or anything like that, you can just use the path of the file, or if its in the same folder as your script, just the filename.