1
我想根據新的行字符拆分字符串,並用'。'替換新行。在python中。我試過這個代碼,但我沒有得到它。如何從python中的字符串搜索新的行字符
import nltk
from nltk.tokenize.punkt import PunktSentenceTokenizer, PunktParameters, PunktLanguageVars
ex_sent="Conclusion & Future Work
In our project we have tried for implementing northbound SDN application for OpenFlow protocol evaluation. The client and the RYU application is being connected, via socket connection."
class CommaPoint(PunktLanguageVars):
sent_end_chars = (',','\n')
tokenizer = PunktSentenceTokenizer(lang_vars = CommaPoint())
sentences = sentence_splitter.tokenize(ex_sent)
print sentences
謝謝Laszlowaty我欠你一個... –