I am very new to Python. So please give specific advice. I am using Python 3.2.2.
I need to read a large file set in my computer. Now I can not even open it. To verify the directory of the file, I used:
>>> import os
>>> os.path.dirname(os.path.realpath('a9000006.txt'))
It gives me the location 'C:\\Python32'
Then I wrote up codes to open it:
>>> file=open('C:\\Python32\a9000006.txt','r')
Traceback (most recent call last):
File "<pyshell#29>", line 1, in <module>
file=open('C:\\Python32\a9000006.txt','r')
IOError: [Errno 22] Invalid argument: 'C:\\Python32\x079000006.txt'
Then I tried another one:
>>> file=open('C:\\Python32\\a9000006.txt','r')
Traceback (most recent call last):
File "<pyshell#33>", line 1, in <module>
file=open('C:\\Python32\\a9000006.txt','r')
IOError: [Errno 2] No such file or directory: 'C:\\Python32\\a9000006.txt'
Then another one:
>>> file=open(r'C:\Python32\a9000006.txt','r')
Traceback (most recent call last):
File "<pyshell#35>", line 1, in <module>
file=open(r'C:\Python32\a9000006.txt','r')
IOError: [Errno 2] No such file or directory: 'C:\\Python32\\a9000006.txt'
The file is saved in the Python folder. But, it is in a folder, so the path is D\Software\Python\Python3.2.2\Part1\Part1awards_1990\awd_1990_00
. It is multiple layers of folders.
Also, and anyone share how to read the abstract section of all files in that folder? Thanks.