Advertisement
Guest User

dictionary extraction

a guest
Apr 27th, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. def readFile(fileName):
  2. infile = open(fileName, 'r')
  3. firstLine = infile.readline()
  4. rows = infile.readlines()
  5. infile.close()
  6.  
  7. info = {}
  8. for row in rows:
  9. cols = row.split(',')
  10. info[cols[0]], int(cols[2])
  11.  
  12. return(info)
  13.  
  14. data = readFile('data.txt')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement