【发布时间】:2021-04-26 10:21:51
【问题描述】:
我尝试在 python 中创建这个切换器:
def mainswitcher(i):
switcher={
#SelfOptions#
"test": "SomeStringherefortest",
"test2": "SomeStringherefortest2",
"test3": "SomeStringherefortest3" }
现在我必须得到一份名单。所以我需要list = [test,test2,test3]
这是如何工作的?它甚至有效吗?我知道我不能循环通过一个对象 - 但有办法吗?
【问题讨论】:
-
喜欢
tests = list(switcher)? -
@khelwood 我该怎么称呼这个 - 没有我?