我正在阅读一些xml,其中的信息存储为
H.P. Dembinski, B. K\'{e}gl, I.C. Mari\c{s}, M. Roth, D. Veberi\v{c}
我想得到这个确切的格式,然而,我得到
^{pr2}$所以我的问题是在我的处理步骤中哪里出错了? 这就是我要做的
today = some date
base_url = "http://export.arxiv.org/oai2?verb=ListRecords&"
url = (base_url + "from=%s&until=%s&" % (today, today) + "metadataPrefix=arXivRaw")
try:
response = urllib2.urlopen(url)
except urllib2.HTTPError, e:
return
rawdata = response.read()
root = ET.fromstring(rawdata)
if root.find(OAI+'ListRecords') is not None:
for record in root.find(OAI+'ListRecords').findall(OAI+"record"):
author_string = info.find(ARXIVRAW+"authors").text
我怎样才能阻止第二个\?我知道我可以做一些replace(),但一定有办法只得到原始文本? 谢谢 卡尔
您看到的只是字符串的内部表示,它使用双
\\
来显示转义的反斜杠。如果打印字符串,您应该只看到一个\
。示例-您还可以注意到开始处的
u
表示它是unicode字符串的内部表示形式。在所以它很好,即使是在写文件时,等等。它应该可以正常工作,只有一个
\
会出现。在相关问题 更多 >
编程相关推荐