1
的一部分,我有以下代码:Python的熊猫read_excel - 用户输入IO名
filename=input("Name of file?")
sheet=input("Name of sheet?")
df=pd.read_excel('C:/Users/Path/JAN.xls', \
sheetname=sheet,\
header=0,\
parse_cols="C:BD",\
na_values='T')
我想文件名的“Jan”的一部分。根据该文件运行前用户输入是可变的。例如,我在同一目录中有其他文件,标记为“/ JAN”,“/ FEB”,“/ MAR”等。如何根据用户输入添加可以更改文件io的变量?
''C:/用户/路径/ {} xls'.format(文件名)'? – MaxU