从 Python 字符串中删除 u202a [英] Remove u202a from Python string
本文介绍了从 Python 字符串中删除 u202a的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试用 Python 打开一个文件,但出现错误,在字符串的开头我得到了一个 /u202a
字符...有谁知道如何删除它?
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?
def carregar_uml(arquivo, variaveis):
cadastro_uml = {}
id_uml = 0
for i in open(arquivo):
linha = i.split(",")
carregar_uml("H:\\7 - Script\\teste.csv", variaveis)
OSError: [Errno 22] 无效参数:'\u202aH:\7 - Script\teste.csv'
推荐答案
问题是文件的目录路径没有正确读取.使用原始字符串将其作为参数传递,它应该可以工作.
The problem is the directory path of the file is not read properly. Use raw strings to pass it as argument and it should work.
carregar_uml(r'H:\7 - Script\teste.csv', variaveis)
这篇关于从 Python 字符串中删除 u202a的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文