处理思路
参考
处理步骤:
(单条处理:)
1、选知网NoteExpress格式的2-7行复制信息
2、新建一个文本文件,命名为cite.txt,把知网所复制信息粘贴进来
(txt文件保存编码ANSI可行)
3、新建一个Python运行文件(与文本文件同目录)
(PS: “@mastersthesis{”) # 默认写的是硕士论文)
with open("cite.txt","r") as f:
data = f.readlines()
# data = file.readlines()
print(data,len(data))
newid=data[1][9:11]+data[-1][8:]+data[0][9:15]
newid = newid.replace(" ", "")
print(newid)
with open("test.txt", "w") as f:
f.write("@mastersthesis{") # 默认写的是硕士论文(..)
f.write(newid)
f.write(",\n")
for i in range(len(data)):
a = str(data[i]).lower()
a=a.replace("{", "")
a=a.replace("}", "")
a=a.replace(": ", "={")
a = a.replace(" ", "")
a = a.replace("\n", "}",1)
if i+1!=len(data):
a = a + ",\n"
else:
a = a + "}"
print(a)
with open("test.txt", "a") as f:
f.write(a)
with open("test.txt", "a") as f:
f.write("\n}")
4、运行得到test.txt,打开,得到对应该条参考文献的Bibtex格式的信息,粘贴到bib文件内,latex调用引用