I am very new at python, so this might sound stupid. I searched but I did not find a solution.
I have a function in python called ExcRng. What kind of for loop can I do with the function so it stores the values in independents variables? I do not wish to store them in a list, but as an independent variable.
I am looking for something like this.
EDIT* So to clarify, the inputs "a" to "n" are strings. The output df1, df2...dfn are DataFrames.
List=[a,b,c,d,e...,n]
for i in List:
df1=ExcRange(i)
df2=ExcRng(i)
...
dfn=ExcRng(in)
You can access each element just by their index number. But if you want to have independent variables just make one venerable for one element of the List, you don't need for loop for that.
List = [a,b,c,d,e,f]
#for the first element a
df1 = ExcRange(List[0])
#for the second element b
df2 = ExcRange(List[1])
#etc List[5] = f
I would recommend you to always use list instead of multiple values because you're saving memory and your code is looking way cleaner. You can learn them, they are pretty easy
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With