구문 분석하는 방법을 각각 사용하여 응답 regex

0

질문

누구든지 나를 도울 수 있습니 parse 이러한 메시지가 있습니까? 이러한 반응은 TCP 소켓 연결으로 트 채널 채팅. 때로는 응답은 하나의 메시지,때때로,여러 특히 바쁜습니다. 당신이 볼 수있는 아래 1 응답에서"를 사용하여 응답---". 첫번째 3 에 대한 응답이 2 메시지를 다음 세가 1 하고,다음 두 가지가 여러입니다.

Response ----  :[email protected] PRIVMSG #xqcow :ring them up
:[email protected] PRIVMSG #xqcow :karma for laughing at the dancing guy FeelsBadMan

Response ----  :[email protected] PRIVMSG #xqcow :!emotes bttv
:[email protected] PRIVMSG #xqcow :CiGrip

Response ----  :[email protected] PRIVMSG #xqcow :H H H H H H
:[email protected] PRIVMSG #xqcow :OMEGALUL

Response ----  :koolaidjammer__!koolaidjammer__@koolaidjammer__.tmi.twitch.tv PRIVMSG #xqcow :xqcHead xqcHead xqcHead

Response ----  :its_physikz!its_physikz@its_physikz.tmi.twitch.tv PRIVMSG #xqcow :xqcSus BLOW PIPES?

Response ----  :syon_!syon_@syon_.tmi.twitch.tv PRIVMSG #xqcow :CiGrip ONLY 40?

Response ----  :[email protected] PRIVMSG #xqcow :MARIJUANA
:choomoo__!choomoo__@choomoo__.tmi.twitch.tv PRIVMSG #xqcow :HOW IS THERAPY BATCHEST OMEGALUL
:[email protected] PRIVMSG #xqcow :LULW
:[email protected] PRIVMSG #xqcow :CiGrip NICE
:[email protected] PRIVMSG #xqcow :H GG

Response ----  :tnr_gio!tnr_gio@tnr_gio.tmi.twitch.tv PRIVMSG #xqcow :mothakeeeeee
:[email protected] PRIVMSG #xqcow :xqKaren IM STRESSIN BRUH
:logic_al!logic_al@logic_al.tmi.twitch.tv PRIVMSG #xqcow :i'll smoke to that
:[email protected] PRIVMSG #xqcow :madafeh PepegaPls madh PepegaPls madafuPepegaPls madaPepegaPls mada PepegaPls
:[email protected] PRIVMSG #xqcow :FeelsBadMan

나는 생각하고 있었기 때문 각각의 메시지에 대한 응답은 두":"생각하고 있었을 분리하는 문자열 모든 두":"using regex. 어떤 도움 감사

python regex
2021-11-24 05:52:54
1

최고의 응답

0

당신이 사용할 수 있는 간단한 str 방법

spam = """Response ----  :[email protected] PRIVMSG #xqcow :ring them up
:[email protected] PRIVMSG #xqcow :karma for laughing at the dancing guy FeelsBadMan

Response ----  :[email protected] PRIVMSG #xqcow :!emotes bttv
:[email protected] PRIVMSG #xqcow :CiGrip

Response ----  :[email protected] PRIVMSG #xqcow :H H H H H H
:[email protected] PRIVMSG #xqcow :OMEGALUL

Response ----  :koolaidjammer__!koolaidjammer__@koolaidjammer__.tmi.twitch.tv PRIVMSG #xqcow :xqcHead xqcHead xqcHead

Response ----  :its_physikz!its_physikz@its_physikz.tmi.twitch.tv PRIVMSG #xqcow :xqcSus BLOW PIPES?

Response ----  :syon_!syon_@syon_.tmi.twitch.tv PRIVMSG #xqcow :CiGrip ONLY 40?

Response ----  :[email protected] PRIVMSG #xqcow :MARIJUANA
:choomoo__!choomoo__@choomoo__.tmi.twitch.tv PRIVMSG #xqcow :HOW IS THERAPY BATCHEST OMEGALUL
:[email protected] PRIVMSG #xqcow :LULW
:[email protected] PRIVMSG #xqcow :CiGrip NICE
:[email protected] PRIVMSG #xqcow :H GG

Response ----  :tnr_gio!tnr_gio@tnr_gio.tmi.twitch.tv PRIVMSG #xqcow :mothakeeeeee
:[email protected] PRIVMSG #xqcow :xqKaren IM STRESSIN BRUH
:logic_al!logic_al@logic_al.tmi.twitch.tv PRIVMSG #xqcow :i'll smoke to that
:[email protected] PRIVMSG #xqcow :madafeh PepegaPls madh PepegaPls madafuPepegaPls madaPepegaPls mada PepegaPls
:[email protected] PRIVMSG #xqcow :FeelsBadMan
"""


for response in spam.replace('Response ----  ', '').split('\n\n'):
    print(response.strip().splitlines())

당신이 메시지를 얻을 수 있는 각각의 응답으로 목록입니다. 작업할 수 있습니다 여기에서 당신 걱정하지 않는 경우 메시지에서 온 다른 응답

2021-11-24 06:12:49

다른 언어로

이 페이지는 다른 언어로되어 있습니다

Русский
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................