I have this code in python.
import sys
list1 = [\"A\", \"B\", \"C\"]
list2 = [1, 2, 3]
myarg = sys.argv[1]
print len(myarg)
I will run thi
While this is entirely possible in Python, it's not needed. The best solution here is to not do this, have a dictionary instead.
import sys
lists = {
"list1": ["A", "B", "C"],
"list2": [1, 2, 3],
}
myarg = sys.argv[1]
print len(lists[myarg])
You note you have 13 lists in your script - where you have lots of similar data (or data that needs to be handled in a similar way), it's a sign you want a data structure, rather than flat variables. It will make your life a lot easier.