1>>> from string import punctuation
2>>> from re import sub
3>>>
4>>> string = "\Fred-Daniels!"
5>>> translator = str.maketrans('','', sub('\-', '', punctuation))
6>>> string
7'\\Fred-Daniels!'
8>>> string = string.translate(translator)
9>>> string
10'Fred-Daniels'
11
1>>> name = '\\test-1.'
2>>> valid_characters = 'abcdefghijklmnopqrstuvwxyz1234567890- '
3>>> filtered_name = ''.join([ x for x in name if x.lower() in valid_characters ])
4>>> print(filtered_name)
5test-1
6