📜  你可以编辑 string.punctuation - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:12.728000             🧑  作者: Mango

代码示例2
>>> name = '\\test-1.'
>>> valid_characters = 'abcdefghijklmnopqrstuvwxyz1234567890- '
>>> filtered_name = ''.join([ x for x in name if x.lower() in valid_characters ])
>>> print(filtered_name)
test-1