0
我想多個列表合併成一個列表如何將多個列表合併成一個列表在Python 3.5?
e.g:['of', 'participants:', '25']['participants:', '25', 'we']['25', 'we', 'require']
代碼之後: 「['of', 'participants:', '25'],['participants:', '25', 'we'],['25', 'we', 'require']
」
for wrd in d:
child=child.lower()
child=child.replace(' ','')
dat =child
r = re.compile(dat)
s=str(wrd)
test=[sentence in dat for sentence in s]
if r.search(s) and any(test):
print(s)
S = STR(WRD) 測試= [句子中的DAT中代表S句子]如果r.search(S)和任何(測試) : 打印(S)....我很越來越[ '的', '參與者:', '25'] [ '參與者:', '25', '我們'] [ '25', '我們', '需要'],但我需要輸出爲[ '中', '參與者:', '25'], [ '參與者:', '25', '我們'], [ '25', '我們', '需要'] –
讓我知道這是否幫助我認爲是你的要求 – wetw0rk
那麼listOne = [ '的', '參與者:', '25'] [ '參與者:', '25', '我們'] [ '25', '我們', '需要' ]這是我得到的 –