This code:
lst = range(59, 125)
df2 = df2.rename(columns={col: col+'.'
for idx, col in enumerate(df2.columns)
if idx in lst})
adds a punctuation mark at the end of every title in a column. But it adds a spacemark just before the punctuation mark. E.g. Code turns:
I would never do that
to:
I would never do that .
And I want:
I would never do that.
ALSO
Some titles have a question mark at the end and this code adds a punctuation mark after it. How can I modify or add to my code to not place a punctuation marks after question marks?
E.g. Code turns:
Are you satisfied?
to:
Are you satisfied?.