I have a task in which I need to read from text file and call a function. The text file is following:
black,20,10,3,1
red,10,20,4,3
blue,10,-20,-4,3
My defined function takes five parameters, which are split in the text flile by commas. This is what I have so far:
with open(textfile) as source:
for i in source.readlines():
a = split(",")
But here I have no idea how to call the function with the read line from source.
Any ideas?
myfunc(a[0], a[1] ....)?func(a[0],a[1],a[2],a[3],a[4])? or more briefly:func(*a)?