python 经常使用技巧 — 列表2(list)

 

1. 删除字符串列表中的数字字符串 (deletes a numeric string from the string list)python

参考连接: https://stackoverflow.com/questions/16908186/python-check-if-list-items-are-integersgit

1 In [20]: a=['治理', '经费', '20', '模式', '科研', '91', '管理', '政府'] 2 
3 In [21]: b=[s for s in a if not s.isdigit()] 4 
5 In [22]: b 6 Out[22]: ['治理', '经费', '模式', '科研', '管理', '政府']

 

2. spa

相关文章
相关标签/搜索