Remove u202a from Python string

后端 未结 6 830
一整个雨季
一整个雨季 2020-12-11 10:07

I\'m trying to open a file in Python, but I got an error, and in the beginning of the string I got a /u202a character... Does anyone know how to remove it?

6条回答
  •  伪装坚强ぢ
    2020-12-11 10:35

    Or you can slice out that character

    file_path = r"‪C:\Test3\Accessing_mdb.txt"
    file_path = file_path[1:]
    with open(file_path, 'a') as f_obj:
    f_obj.write('some words')
    

提交回复
热议问题