python 使用 split()、strip()、replace() 等函数进行处理大小写

有以下字符串:

    strZen  = '''   siMPle iS bEtter thAn c0MplEx.
             eRr0rs Sh0uLd nEveR PasS sIlently.   
             n0w iS beTtER THan NeveR.  '''

    可以看出,字符串的内容并不工整,并且字母 'o',被错误的写成了数字字符 '0';

    使用 split()、strip()、replace() 等函数进行处理,并输出为如下格式:

    Simple is better than complex.
    Errors should never pass silently.
    Now is better than never.
strZen  = '''   siMPle iS bEtter thAn c0MplEx.
             eRr0rs Sh0uLd nEveR PasS sIlently.   
             n0w iS beTtER THan NeveR.  '''
strZen = strZen.strip().replace('0','o').split(".")
for i in strZen:
    print(i.title(),end='')
import re
strZen  = '''   siMPle iS bEtter thAn c0MplEx.
             eRr0rs Sh0uLd nEveR PasS sIlently.   
             n0w iS beTtER THan NeveR.  '''
strZen = strZen.replace("0","o")
a = re.findall(r"\S.*?\.",strZen,re.S)
a = [i.capitalize() for i in a]
print(*a)
strZen  = '''   siMPle iS bEtter thAn c0MplEx.
             eRr0rs Sh0uLd nEveR PasS sIlently.   
             n0w iS beTtER THan NeveR.  '''
strZen = strZen.replace("0","o").lower().strip()
a = strZen.split('.')
for s in a:
    if s:
        b=s.strip().split(' ')
        b[0]=b[0].title()
        c=' '.join(b)+‘.’
        print(c)
print(*a)