you are on Windows, that uses backslash as path separator
\
However for python this is escape char, so you need to use forward slash or raw string or escape the backslash. In addition you should use with context manager when open the file. It will close the file for you at the end (something you don't do in your code)with open('E:/baby2008.txt','r') as f: # do something here
with open(r'E:\baby2008.txt','r') as f: # do something here
with open('E:\\baby2008.txt','r') as f: # do something here