第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

提取包含關鍵字的行

提取包含關鍵字的行

慕桂英546537 2021-09-14 20:44:32
修改問題,每當col1有關鍵字時,我想提取col2中的時間戳關鍵字=[“我可以幫助你”,“我肯定可以幫助你”,“我可以檢查并幫助你”,“我會非常樂意幫助你”,“讓我?guī)椭阍谶@方面”,“更好地幫助您”]鑒于excel數據是,    col1                                                                                                                            1.agent enters(as arrin)2.3.I'll be happy to assist you. Give me a moment to review your request.4.I see that the light in your Modem is Blinking Red. Am I right ?5.Thank you for the detailed information.6.Please do not worry.7.Don't worry johny. I can help you with that.8.Let me connect this chat to the concern team to help you out with this,   Please stay connected.   col21. 2018-10-14 21:16:582. 2018-10-14 21:17:003. 2018-10-14 21:17:404. 2018-10-14 21:18:255. 2018-10-14 21:19:396. 2018-10-14 21:19:437. 2018-10-14 21:21:048. 2018-10-14 21:22:00例如關鍵字之一出現(xiàn)在第 7 行,因此要提取 col2 中的相應時間戳所需的輸出應如下所示,[出]:2018-10-14 21:21:04提前致謝
查看完整描述

2 回答

?
白板的微信

TA貢獻1883條經驗 獲得超3個贊

嘗試這個:


keywords = [

            "i can help you with that",

            "i can surely help you with that",

            "i can check and help you with that",

            "i will be more than happy to help you",

            "let me assist you on this",

            "to assist you better"

]


for phrase in keywords:

    for row in col1:

        if phrase in row.lower():

            return row

所以這是在做的是查看你的 excel 表的列......


          col1

1 Hello and welcome

2 There's a lot to see here

3 Sorry, no can do

4 I can help you with that if you'd like

并一一瀏覽它們。如果其中一行包含您的關鍵短語...


>I can help you with that< if you'd like

它會返回整行。您可以打印而不是返回或任何您想要對行執(zhí)行的操作。.lower() 方法是因為我們的關鍵字以小寫形式存儲,因此應該將它們與行的小寫版本進行比較。如果匹配,我們可以返回原始情況下的行。當然,我假設您已經成功地將您的數據導入 col1 中,就像某種列表一樣……如果您需要幫助,請告訴我。


查看完整回答
反對 回復 2021-09-14
?
catspeake

TA貢獻1111條經驗 獲得超0個贊

我認為這會有所幫助


import re


keywords=[

    "i can help you with that", 

    "i can surely help you with that", 

    "i can check and help you with that", 

    "i will be more than happy to help you", 

    "let me assist you on this", "to assist you better",

]


file_contents = '' # here is where you get contents from excel file


for line in file_contents:

    for keyword in keywords:

        temp = re.search(r''+ keyword +'', line, flags=re.IGNORECASE)

        if temp:

            print('[out]:',  line)


查看完整回答
反對 回復 2021-09-14
  • 2 回答
  • 0 關注
  • 194 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號