def not_empty(s):
return s and s.strip()
print(list(filter(not_empty,[' C'])))
按照我的理解输出应该为['C']
可是结果为[' C'],前面的空格仍然保留,请问是怎么回事呢?
def not_empty(s):
return s and s.strip()
print(list(filter(not_empty,[' C'])))
按照我的理解输出应该为['C']
可是结果为[' C'],前面的空格仍然保留,请问是怎么回事呢?