Using Integer as Array Name in Python -


I would like to convert an integer to an array name in Python. I do not know that this is also possible. Assistance is highly appreciated.

  a = int (10) Print ["1"] should come back & gt; & Gt; 10 ["1"]  

I do not even think eval This will do (though you do not want to do this anyway) Your best bet is to use a dict , which can make an integer in a key.

  int_dict = {} int_dict [10] = ["1"]  

However, I believe your use case is a bit misleading. You want different list content.


Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

java - Gradle dependencies: compile project by relative path -

ruby on rails - Object doesn't support #inspect when used with .include -