0

I wish to create list of each element of a list. what I want is: if cities = ["detroit" , "chicago" , "portland"]; then create 3 lists:

detroit = [""];
chicago = [""];
portland = [""];

1 Answers1

0

That is not a good idea, but that's your decision. This will do what you want.

cities = ["detroit" , "chicago" , "portland"]
if cities == ["detroit" , "chicago" , "portland"]:
    for city in cities:
        exec("{} = [\"\"]".format(city))
simonzack
  • 19,729
  • 13
  • 73
  • 118