【发布时间】:2017-05-24 11:52:08
【问题描述】:
我的数据包含一长串字符串,我想将它们转换为整数,但仍保留一些包含特殊字符的字符串:x、.、... 作为字符串。有人可以帮我过滤有特殊字符的字符串吗?
字符串列表:
Type Values
str 1
str 1
str 1
str 1
str 0
str 10.0.0.21
float nan
str 0
str 38082
str -10
str -12
str 0xE0020000
预期类型:
Type Values
Int 1
Int 1
Int 1
Int 1
Int 0
Str 10.0.0.21
Float nan
Int 0
Int 38082
Int -10
Int -12
Str 0xE0020000
【问题讨论】:
标签: python string python-3.x filter