我作为Hi, my name is Will, And i am from Canada. I have 2 pets. One is a dog and the other is a Zebra. Ahoi! Thanks.
分离使用预定义字符的字符串
我想从.
和拆分这句话文本“!”,我怎么能做到这一点。我也想知道从哪个角色分句子。
例如结果应该是:
实施例1:
Hi, my name is Will, And i am from Canada || The sentence was split with .
实施例2:
Ahoi! || The sentence was split with !
我怎样才能做到这一点?我的工作到目前为止:
print (text.split('.'))
- 这只打破与.
的句子,我无法确定它用于分裂的字符。
是要知道哪些字是用来分割或如何分割句子的问题? –