I have a function that parses a file into a list. I\'m trying to return that list so I can use it in other functions.
def splitNet():
network = []
f
If you want to return an item or list from a definition, you could define it before hand and use it as a variable during the initial writing of said definition. Unless it has to be defined within the definition. In this case you won't need to write in a return command at the end.
network = []
def splitNet(network):
for line in open("/home/tom/Dropbox/CN/Python/CW2/network.txt","r").readlines():
line = line.replace("\r\n", "")
line = string.split(line, ',')
line = map(int, line)
network.append(line)
print network # Will print the list you've appended. But it is now a usable object.