You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
12 lines
236 B
Python
12 lines
236 B
Python
4 weeks ago
|
import os
|
||
|
|
||
|
|
||
|
def sanitize_filename(filename, replacement="_"):
|
||
|
if os.name == 'nt':
|
||
|
invalid_chars = '<>:"|?*'
|
||
|
|
||
|
for char in invalid_chars:
|
||
|
filename = filename.replace(char, replacement)
|
||
|
|
||
|
return filename
|