置換する文字を複数指定[Python]
import re patterns = "dog|cat|fox" repl = "animal" sentence = "dog, cat, fox, pen." re.sub(patterns, repl, sentence) >> 'animal, animal, animal, pen.'
replaceではなくre.subで置換するパターンを正規表現で指定するのだ。
画像処理や自然言語処理などのハマりどころをまとめます

from datetime import datetime datetime.n ...

環境 Ubuntu 16.04Python 3.8.2 現在のIPアドレスを確認 ...

vastee.hatenablog.com の続き 今回は学習したモデルを使って ...

インストール pip install pyyaml まずは、config.yam ...

from pathlib import Path def txt_to_df(s ...
円安により毎月のサーバー代(AWS Lightsail)で赤字です。本ブログを支援していただけないでしょうか?Ko-fiというファンからの寄付やチップを受け取るためのプラットフォームを利用しております。
ディスカッション
コメント一覧
まだ、コメントがありません