Guest User

Untitled

a guest
May 22nd, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. # function that loads given .txt file and return is as list of lists
  2. def open_file(file_name)
  3. try:
  4. with open(str(os.path.abspath(__file__)+str(file_name)), "r") as f:
  5. lines = f.readlines()
  6. game_statistic_list = [element.replace("\n", "").split("\t") for element in lines]
  7. except IOError:
  8. print("%s does not exist in program directory" % file_name)
  9.  
  10. return game_statistic_list
Add Comment
Please, Sign In to add comment