Oct-22-2019, 08:42 AM
I have an eternal file in this format: "4b32j","aq8","71yt346" only much longer. I want to load each item one at a time for processing. I can't find how to do this, so I tried to load the whole file and split it up. But it loads as a complete string anyway. I used the code below:
This just gives me [' "4b32j","aq8","71yt346" ']. If I load it as a string, it still comes in as strings within a string.
Can you suggest how I could open the file and load just one item at a time sequentially, please? I've searched Python help, but could only find material on loading specific lengths or lines, not items.
1 2 3 4 5 |
path = '/Users/davidellis/Documents/Python 3 Files/docCodes_File.txt' test = open (path, 'r' ) play = [test.read()] test.close() print (play) |
Can you suggest how I could open the file and load just one item at a time sequentially, please? I've searched Python help, but could only find material on loading specific lengths or lines, not items.