example:
word .word should changes to word. word
word( word )word should changes to word (word) word
my code doesn't corrects the spaces!
Expand|Select|Wrap|Line Numbers
- import re
- def c (file):
- with open ('c.txt')as f1:
- for line in f1:
- result = re.sub(r'\s([?.!(){}[]:;,"](?:\s|$))', r'\1', line)
- f2 = open ('zzzzz.txt', 'a')
- f2.write(result)
- print(result)