首页 > 解决方案 > 使用参数作为变量错误Python

问题描述

尝试使用 int 变量"row"作为Excelread行中的参数,以便我可以迭代。我收到错误,因为 python 没有识别为 int 输入?

from automagica import *
Row = 2

current_run = ExcelReadCell(path="C:\\Users\\jmoloney\\Downloads\\Medicaid.xlsx", r=Row, c=1, sheet=None)
Row = Row+1
print(current_run)

输出:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: ExcelReadCell() got an unexpected keyword argument 'r'

标签: pythonexcelvariables

解决方案


我想通了,格式已关闭,必须使用

ExcelReadRowCol(path="C:\Users\jmoloney\Downloads\Medicaid.xlsx", r=Row, c=1, sheet=None)

vs ExcelReadCell(xxx


推荐阅读