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.
")"との間のものを削除するにはどうすればよいですか"|"
")"
"|"
例えば、
str = "left)garbage|right"
出力が必要です"left)|right"
"left)|right"
>>> import re >>> s = "left)garbage|right" >>> re.sub(r'(?<=\)).*?(?=\|)', '', s) 'left)|right' >>> re.sub(r'\).*?\|', r')|', s) 'left)|right'