File size: 236 Bytes
240e0a0
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
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