Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python os path safe string

import re

invalidFile = "File!name?.txt"
f = open(os.path.join("/tmp", re.sub('[^-a-zA-Z0-9_.() ]+', '', invalidFile))
 
PREVIOUS NEXT
Tagged: #python #os #path #safe #string
ADD COMMENT
Topic
Name
3+5 =