python新手。我使用了一个名为pdfminer的包,在这个包中,有一个命令pdf2txt.py
在下面的代码中使用。我在单引号和双引号上有问题。我想在Windows中像这样使用os.system()
:
os.system('pdf2txt.py -o "E:\PDF\output.txt" "E:\PDF\A Functional Genetic Approach Identifies the PI3K Pathway as a Major Determinant of Trastuzumab Resistance in Breast Cancer.pdf"')
在Windows中,"E:\PDF\A Functional Genetic Approach Identifies the PI3K Pathway as a Major Determinant of Trastuzumab Resistance in Breast Cancer.pdf"
必须使用双引号。在
现在,我使用strSource = "E:\PDF\A Functional Genetic Approach Identifies the PI3K Pathway as a Major Determinant of Trastuzumab Resistance in Breast Cancer.pdf"
,但是我在os.system()
中使用StrSource
,它不能得到{strSource
可能等于'E:\PDF\A Functional Genetic Approach Identifies the PI3K Pathway as a Major Determinant of Trastuzumab Resistance in Breast Cancer.pdf'
。如何将'
转换为"
?在
它起作用了!在
如果问题如您所说,那么您可以简单地使用
str
replace
方法:例如
^{pr2}$相关问题 更多 >
编程相关推荐