【发布时间】:2018-05-31 09:51:16
【问题描述】:
wxPython 中的一些小部件有一个类似“GetSelections()”的方法,它返回所选项目的索引列表。 有了这个索引列表,我可以得到一个项目列表。这样,例如:
>>> list_of_items = ['zero', 'one', 'two', 'three', 'four', 'five']
>>> list_of_indexes = [1,3,5]
>>> [list_of_items[e] for e in list_of_indexes]
['one', 'three', 'five']
所以问题是:最后一个字符串有快捷方式吗?比如:
list_of_items.getitems(list_of_indexes)
谢谢!
【问题讨论】:
标签: python python-3.x list indexing wxpython