为什么文件名开头会多加一个引号



我正在尝试在df.to_excel中动态命名我的输出文件,如下所示:

df.to_excel(r'C:Usersexcel_outputs'Solved'+str(f), index = False)

此外,str(f(包含我的输入文件名,每次都会更改。我得到的文件名是:

'Solvedsheet1
'Solvedsheet2
'Solvedsheet3

我只想:

Solvedsheet1
Solvedsheet2
Solvedsheet3

这是一个单独的字符串,所以…

f = 'sheet1'
x = r"C:Usersexcel_outputsSolved"+str(f)
print(x)

结果。。。。

C:Usersexcel_outputsSolvedsheet1

最新更新