问题遇到的现象和发生背景
Cats are smarter than dogs.
这句话用正则表达式改变为 Dogs are smarter than cats. 注意大小写
问题相关代码,请勿粘贴截图
import re
text="Cats are smarter than dogs."
运行结果及报错内容
我的解答思路和尝试过的方法
先转换成小写,将首尾互换,再将首字母改成大写,但是不会写相关的正则表达式
我想要达到的结果
Cats are smarter than dogs.
这句话用正则表达式改变为 Dogs are smarter than cats. 注意大小写