B
B
become_iron2015-02-27 17:07:40
Python
become_iron, 2015-02-27 17:07:40

How to make it so that the program itself can create variables, lists, tuples, etc. in Python?

How to make it so that the program itself can create variables, lists, tuples, etc. in Python?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey Dugin, 2015-03-01
@become_iron

exec()
eval()
also look at the namedtuple class sources of the collections module

>>> exec('a = [1,2,3]')
>>> a
[1, 2, 3]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question