Guest User

Untitled

a guest
Jan 17th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. def getLines( filename ):
  2. path = Cocoa.NSBundle.mainBundle().bundlePath()
  3.  
  4. real_path = path[0: len(path) - 8]
  5.  
  6. print real_path
  7.  
  8. f = open(real_path + filename, 'r') # open the file as an object
  9.  
  10. if len(f.read()) <= 0:
  11. lines = {} # list to hold lines in the file
  12. for line in f.readlines(): # loop through the lines
  13. line = line.replace( "r", " " )
  14. line = line.replace( "t", " " )
  15. lines = line.split(" ") # segment the columns using tabs as a base
  16. f.close() # close the file object
  17.  
  18. return lines
  19.  
  20. lines = getLines( "raw.txt" )
  21. for index, item in enumerate( lines ): # iterate through lines
  22. # ...
  23.  
  24. f= open(real_path + filename, 'r') # open the file as an object
  25.  
  26. if len(f.read()) <= 0:
  27. lines = {} # list to hold lines in the file
  28. for line in f.readlines(): # loop through the lines
  29.  
  30. f= open(real_path + filename, 'r') # open the file as an object
  31.  
  32. lines = {} # list to hold lines in the file
  33. for line in f.readlines(): # loop through the lines
  34.  
  35. f= open(real_path + filename, 'r') # open the file as an object
  36.  
  37. lines = [] # list to hold lines in the file
  38. for line in f.readlines(): # loop through the lines
  39. # process line
  40. lines.append(line.split(" "))
Add Comment
Please, Sign In to add comment