I have a function(x)
. I have also several dctionaries items that will go as function()
argument x
. I need to write a dynamic name for x
using for loop. In PHP used to be simple, but here I cannot find a simple way. I see posts about creating new dictionaries etc. very complicated. Am I missing something? I thought Python was extra simplistic.
EDIT:
I need this in a dynamic way where a number is replaced with i
:
for i in range(1, 100):
function(x1)
I cannot write function(x1), function(x2), function(x3) 99 times. How to incorporate i
in a simple way without creating dictionaries or lists etc.
Maybe it is not possible the way I want, because x1, x2, x3, ... x99 are dictionaries and also object and cannot generate their names in a simple way taking x
and adding i
at the end to make it x1
, can I?
EDIT ends.
I need to add i at the end or a dictionary name:
for i in range(1, 100):
z = 'n'+str(i) # or something like this
function(m.''.i) # this is only an attempt, which is incorrect.