如题,比如我有变量x,想打开表格名为D:/x/x+man.xls,应如何编写程序?
"D:/"+x+"/"+x+"man.xls"
更方便和美观的方法:格式化字符串可以这样:
"D:/{0}/{0}man.xls".format(x)
或
f"D:/{x}/{x}man.xls"