擅长:python、mysql、java
<p>你可以尝试以下任何一种方法-</p>
<p><strong>带</strong><a href="https://regex101.com/r/fsp3FS/7" rel="nofollow noreferrer">REGEX</a></p>
<pre><code>import pandas as pd
pd.set_option('max_colwidth', 400)
df = pd.DataFrame({'Reviews':['dealer said it does not reimburse dealers for loaners or rentals... so why even be a dealership if they make faulty cars and you re on the line to help customers']})
df['Reviews'] = df['Reviews'].replace('\.+','.',regex=True)
print(df)
</code></pre>
<p><strong>带</strong><a href="https://regex101.com/r/fsp3FS/6" rel="nofollow noreferrer">REGEX</a></p>
^{pr2}$
<p><strong>带</strong><a href="https://regex101.com/r/eM5kV8/30" rel="nofollow noreferrer">REGEX</a></p>
<pre><code>import re
regex = r"(\W)\1+"
test_str = "dealer said it does not reimburse dealers for loaners or rentals... so why even be a dealership if they make faulty cars and you re on the line to help customers"
subst = "\\1"
result = re.sub(regex, subst, test_str, 0, re.MULTILINE)
if result:
print (result)
</code></pre>