test_string = 'asdf!_[]' # 1 []를 삭제하기 : translate 사용 string01 = test_string.translate({ord('['): '', ord(']'): ''}) # 2 ! 삭제하기 : replace 사용 string02 = test_string.replace('!', '') # 3 _ 삭제하기 : 여러개의 text를 dict에 넣고 변환해줄때 remove_dict = { "_": "" } for s in remove_dict.keys(): if s in test_string: string03 = test_string.replace(s, remove_dict[s])