# Method: Load levelsList using the data in levelsFile
def readLevelsFromFile(self):
try:
# Set levelsList to an empty list
...
# Open the file
...
# Use a loop to read through the file line by line
...
# If the last two characters in the line is "\n", remove them
...
...
# Append the line to levelsList
...
# Close the file
...
except:
return
#replace all ellipsis with applicable code
def readLevelsFromFile(file):
try:
levelslist = []
f = open(file, 'r')
linebyLine = f.readlines()
for i in linebyLine:
if i[-1] == '/n' and i[-2] == '/n':
i.replace(i[-1],'')
i.replace(i[-2],'')
levelslist.append(i)
f.close
except OSError as ex:
return ex.errno
Comments
Leave a comment