在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問(wèn)答/Python/ python 語(yǔ)法問(wèn)題

python 語(yǔ)法問(wèn)題

from serial import Serial
from serial.tools.list_ports import comports

from websocket_server import WebsocketServer


@route('/')
def index(info=''):
    return template('index.html', sers=[(desc, port) for port, desc, hwid in comports()],
                                  ws_url=request.url.replace('http', 'ws').replace('8080', '9978'))

template中 sers=[(desc, port) for port, desc, hwid in comports()]
這是什么語(yǔ)法?

回答
編輯回答
喵小咪

是Python 的推導(dǎo)式(comprehensions)

2017年10月3日 05:05
編輯回答
尛曖昧

這是個(gè)列表生成式 可以看下這文章

2018年3月9日 09:03