前提・実現したいこと
Testbody内の文字をmatch_stringで一致している文字を検索し、fstringで置き換えたいのですが、printしても何も表示されません。
この書き方では駄目なのでしょうか?
該当のソースコード
Testbody = ''' TestId: prod-12345 Testtime : 2018-07-24 19:12:44 Message : testmessage''' match_string = 'TestId: (prod-{key["0"]}).*Message : {key["1"]} ' key = {'0': '12345', '1': 'testmessage'} fst = f'{match_string}' m = re.findall(fst, testbody, flags=re.DOTALL) for match in m: print(match[0]) print(match[1])
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/07/24 07:56