python - 是否可以从python中的集合中丢弃数字字符串(仅包含数字的字符串)?
问题描述
例如,集合是:
{'abc', '123', 'efg', 'er23'}
我想只删除集合中的“123”。在python中可能吗?
解决方案
尝试:
s={'abc', '123', 'efg', 'er23'}
print({i for i in s if not i.isdigit()})
推荐阅读
- bash - 将别名命令从 tcsh 转换为 bash
- c# - 将附加属性绑定到控件模板内的附加属性
- python - RGB 取自 ImageGrab.grab().load() 是在数组还是字符串中
- python - 时间列表中的处理日期
- rest - 如何保存表单集合(CollectionType)
- nstableview - NSTableView 在非 Retina 屏幕上带有模糊的 NSTextField
- javascript - 将整个 Redux 状态对象传递给 React 组件可以吗?
- python - 跳过 Elif 条件
- python - 无效语法:带有 Python 的 Azure CLI
- python - 使用 geckodriver 的 Firefox v67 私人浏览并不总是启用插件