Python去除字符串中所有空格:
a ="14 , 98304 , 15 , 98304 ,"
print a.split()
b =''.join(a.split())
print b
Python去除元组中所有字符串类型元素的首尾空格:
a = ('15 ',' 98304 ',' 14 ',' 98304 ','')
a =tuple([i.strip()for iin a])
print type(a)
print a
Python去除字符串中所有空格:
a ="14 , 98304 , 15 , 98304 ,"
print a.split()
b =''.join(a.split())
print b
Python去除元组中所有字符串类型元素的首尾空格:
a = ('15 ',' 98304 ',' 14 ',' 98304 ','')
a =tuple([i.strip()for iin a])
print type(a)
print a