Answer the question
In order to leave comments, you need to log in
How to change the data type in a list?
Initially, the task was to automatically generate a list of variables from b1 to bn (in the example up to b3), I came up with only this implementation:
b1 = 12
b2 = 23
b3 = 5
v = []
name = "b"
for n in range(1, 3):
x = str(name) + str(n)
v.append(x)
v1 = [int(x) for x in v]
Answer the question
In order to leave comments, you need to log in
You can't make pointers in python.
You can read: ARTICLE ON HABR
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question