Python 保留句子的标点符号,但删除不相关信息的所有特殊字符

Python 保留句子的标点符号,但删除不相关信息的所有特殊字符,python,regex,Python,Regex,我有来自html的文本。目前,我想保留句子的标点符号,但删除不相关信息(非句子)的所有特殊字符 我试着说: sentences = re.sub('none', '', text) sentences = re.sub(ur"[^\w\d'\s]+", '', sentences.strip()) print sentences 正文: 判决结果: acting career of tom cruise started quite early but with a small role

我有来自html的文本。目前,我想保留句子的标点符号,但删除不相关信息(非句子)的所有特殊字符

我试着说:

 sentences = re.sub('none', '', text)
 sentences = re.sub(ur"[^\w\d'\s]+", '', sentences.strip())
 print sentences
正文:

判决结果:

acting career of tom cruise started quite early but with a small role in the movie endless love 1981 however he got his big break as a supporting actor in the movie taps later that year in 1983 his movies risky business and all the right moves along with top gun in 1986 paved the path for tom cruise as an established actor and a superstar after this there was no looking back and tom cruise went to star in many supersuccessful movies like cocktail rain man days of thunder interview with the vampire
then in 1996 he starred as a superspy ethan hunt in the very popular and blockbuster movie which went on to be a series mission impossible that same year he also was seen in the lead role of the movie jerry maguire and won a golden globe for the same in 1999 his supporting role in the movie magnolia again won him his second golden globe
after repeated success in many films tom cruise kept going on with release of two mission impossible movies war of the worlds which was a super duper box office hit and many more
net worth
tom cruises films have gained 73 million worldwide as of 2013 however the net worth of the highest paid actor in hollywood is 270 million and he still gets paychecks from his previous movies

you may also like 
the top 10 highest paid actors of all time

al pacino salary

how much money does jeanclaude van damme make salary  net worth

how much money does arnold schwarzenegger make net worth  biography

how much money does jeanclaude van damme make net worth
posted in
action 
celebs
tags
highest paid actor 
highest paid actor in hollywood 
net worth 
salary 
thomas cruise mapother 
tom cruise

how much money does mike tyson make salary  net worth
how much money does jack black make salary  net worth
问题是如何保留句子的标点符号,但去掉非句子的特殊字符

我希望得到如下结果:

acting career of tom cruise started quite early but with a small role in the movie endless love (1981). however, he got his big break as a supporting actor in the movie taps later that year. in 1983, his movies risky business and all the right moves along with top gun in 1986 paved the path for tom cruise as an established actor and a superstar. after this there was no looking back and tom cruise went to star in many super-successful movies like cocktail, rain man, days of thunder, interview with the vampire.
then in 1996, he starred as a superspy ethan hunt in the very popular and blockbuster movie which went on to be a series, mission: impossible. that same year he also was seen in the lead role of the movie jerry maguire and won a golden globe for the same. in 1999, his supporting role in the movie magnolia again won him his second golden globe.
after repeated success in many films, tom cruise kept going on with release of two mission impossible movies, war of the worlds which was a super duper box office hit and many more.
net worth
tom cruise’s films have gained $7.3 million worldwide as of 2013. however, the net worth of the highest paid actor in hollywood is $270 million and he still gets paychecks from his previous movies.

我将首先使用这个正则表达式从句子中分离出非句子:

(?<=\n|^)[\S]*\s*?[\S]*\s*?[\S]*\s*?[\S]*\s*?[\S]*\s*?[\S]*(?=\n|$)
(?您想删除哪些“非句子特殊字符”?编辑您的问题;而不是全屏转储,制作一个简短的示例,并解释您想要得到什么,而不仅仅是您现在错误地得到了什么。
(?<=\n|^)[\S]*\s*?[\S]*\s*?[\S]*\s*?[\S]*\s*?[\S]*\s*?[\S]*(?=\n|$)