📜  python os 路径安全字符串 - Python 代码示例

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

代码示例1
import re

invalidFile = "File!name?.txt"
f = open(os.path.join("/tmp", re.sub('[^-a-zA-Z0-9_.() ]+', '', invalidFile))