Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
私はこれを行う必要があります:
text = re.sub(r'\]\n', r']', text)
ただし、変数としてfindおよびを使用すると、次のようになります。replace
find
replace
find = '\]\n' replace = ']' text = re.sub(find, replace, text)
r(生)どこに入れればいいですか?文字列ではありません。
r
保つr'...'
r'...'
find = r'\]\n' replace = r']' text = re.sub(find, replace, text)
またはと行く
find = '\\]\\n' replace = ']' text = re.sub(find, replace, text)