Skip to main content
added 125 characters in body
Source Link

First make sure that Python is able to read the path to your file.

from os import path if path.exists('ranks.dat'): # do the file processing else: print('Filepath does not exist.') 

If it prints out that the file path does not exist, then you can provide the full filepath to ranks.dat and it should work.

In addition, you can also use a context manager to open and close the file for you when you are done

with open('ranks.dat', 'r') as f: for line in f.readlines(): print(line) 

First make sure that Python is able to read the path to your file.

from os import path if path.exists('ranks.dat'): # do the file processing else: print('Filepath does not exist.') 

In addition, you can also use a context manager to open and close the file for you when you are done

with open('ranks.dat', 'r') as f: for line in f.readlines(): print(line) 

First make sure that Python is able to read the path to your file.

from os import path if path.exists('ranks.dat'): # do the file processing else: print('Filepath does not exist.') 

If it prints out that the file path does not exist, then you can provide the full filepath to ranks.dat and it should work.

In addition, you can also use a context manager to open and close the file for you when you are done

with open('ranks.dat', 'r') as f: for line in f.readlines(): print(line) 
Source Link

First make sure that Python is able to read the path to your file.

from os import path if path.exists('ranks.dat'): # do the file processing else: print('Filepath does not exist.') 

In addition, you can also use a context manager to open and close the file for you when you are done

with open('ranks.dat', 'r') as f: for line in f.readlines(): print(line)