I am having two issues with my code - I am not sure how to link my populateArray function with my main function; I'm not sure what argument I need to pass Also, I have been having trouble with the file path of the file to be opened - the path is correct and the file exists with data in. Here is my code:
network = []
def populateArray():
file = open('theroute.txt', 'r')
network = []
for line in file:
network.append(line)
print "Network = "
print network
file.close()
def main():
if __name__ == "__main__":
populateArray()
Any help would be appreciated!
Thanks for your replies - my code now looks like the above, but when I remove def main(): I get the following error:
File "populateArray.py", line 18
if __name__ == "__main__":
^
IndentationError: unindent does not match any outer indentation level
def main():line. So, unindent the following two to getif __name__ ...aligned with column #0