比方说:
s = "this is a sentence. My GPA is 1.10. Thanks to StackOverflow, otherwise I would have a lower one."
我想要以下内容:
new_s = "this is a sentence my gpa is 1.10 Thanks to StackOverflow otherwise I would have a lower one"
这就是我要做的:
new_s = s.lower()
new_s = new_s.replace(',', '')
我苦苦挣扎的是替换1.10中的要点
如果我这样做:
new_s = new_s.replace(',', '')
我不会得到想要的输出。有没有办法只选择想要的点(不用来表示十进制数字)?
答案 0 :(得分:1)