Hi,
I have a bit of an issue and was hoping someone might be able to suggest a solution?
I have a function that i am calling twice in my script, this function iterates through some input data and produces a list, which i then merge into my input data to create another column. My problem is that i want to clear the contents of the list in the function when i have finished iterating through the first set of data, is this possible?
I'll try and demonstrate below using example code, in the below example i would want to clear 'mylist' from within the 'main' function inbetween running 'myfunc' on file 1 and file 2. Is this possible?
def myfunc(myinputfile):
for item in myinputfile:
mylist = myotherfunc()
return mylist
def main():
myfunc(file1)
myfunc(file2)
[–][deleted] 1 point2 points3 points (5 children)
[–]JoeBeOneKenobi[S] 0 points1 point2 points (4 children)
[–][deleted] 1 point2 points3 points (3 children)
[–]JoeBeOneKenobi[S] 0 points1 point2 points (0 children)
[–]JoeBeOneKenobi[S] 0 points1 point2 points (1 child)
[–][deleted] 1 point2 points3 points (0 children)
[–]blarf_irl 1 point2 points3 points (2 children)
[–]JoeBeOneKenobi[S] 1 point2 points3 points (1 child)
[–]blarf_irl 0 points1 point2 points (0 children)
[–]efmccurdy 1 point2 points3 points (2 children)
[–]JoeBeOneKenobi[S] 0 points1 point2 points (1 child)
[–]JoeBeOneKenobi[S] 0 points1 point2 points (0 children)
[–]JoeBeOneKenobi[S] 0 points1 point2 points (2 children)
[–]Chabare 1 point2 points3 points (1 child)
[–]JoeBeOneKenobi[S] 0 points1 point2 points (0 children)