【发布时间】:2014-01-30 22:08:35
【问题描述】:
如何使以下功能与 Python 2.7 之前的 Python 版本兼容?
gwfuncs = [reboot, flush_macs, flush_cache, new_gw, revert_gw, send_log]
gw_func_dict = {chr(2**i): func for i, func in enumerate(gwfuncs[:8])}
【问题讨论】:
标签: python dictionary python-2.x python-2.6 dictionary-comprehension