I want to access a list which is field from different python function. Please refer below code for more details
abc = []
name = "apple,orange"
def foo(name):
abc = name.split(',')
print abc
foo(name)
print abc
print name
The output is as below.
['apple', 'orange']
[]
apple,orange
Since I am new to python can anybody explain me why the 7th line (print abc
) doesn't give the result as ['apple', 'orange']?
If I need to have the filled list at the line 7 (['apple', 'orange']), what should I do ?