好的我知道这应该很简单......反正说:
line = "$W5M5A,100527,142500,730301c44892fd1c,2,686.5 4,333.96,0,0,28.6,123,75,-0.4,1.4*49"
我想去除空格。我以为你会这样做
line = line.strip()
但现在行仍然是'$ W5M5A,100527,142500,730301c44892fd1c,2,686.5 4,333.96,0,0,26.6,123,75,-0.4,1.4 * 49'而不是'$ W5M5A,100527,142500,730301c44892fd1c, 2,686.54,333.96,0,0,28.6,123,75,-0.4,1.4 * 49'
有什么想法吗?
答案 0 :(得分:10)
line = line.replace(' ', '')
答案 1 :(得分:0)
另一种方式
line = ''.join(line.split())