re.sub 匹配标点符号、换行实例。
import re
s ="you're asking me out.that's so cute.what's your name again?"
print(re.sub(r"([.!?])", r"\1\n", s))
输出结果:
you're asking me out.
that's so cute.
what's your name again?
re.sub 匹配标点符号、换行实例。
import re
s ="you're asking me out.that's so cute.what's your name again?"
print(re.sub(r"([.!?])", r"\1\n", s))
输出结果:
you're asking me out.
that's so cute.
what's your name again?