0

How to get a variable name out of a List within a for loop.

example:

List = ['a','b','c','d']
for i in List:
    var_i_ = something

so for each letter in list there should be a new variable name like:

var_a_ = something
var_b_ = something
var_c_ = something
var_d_ = something

So i could call use it in pandas as well

List = ['a','b','c','d']
for i in List:
    df_i_ = something

df_a_ = something
df_b_ = something
df_c_ = something
df_d_ = something

each needs to be a different dataframe. I need it as a search function to save data as csv or something else.

2
  • 2
    any reason why you need it? Commented Dec 26, 2017 at 17:41
  • 3
    That's a bad idea. Learn about lists and dictionaries instead. Commented Dec 26, 2017 at 17:41

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.