python-3.x - 在 Spyder IDE 中使用 Python 装饰器
问题描述
我正在尝试在我的 python 代码中编写一个装饰器。当我在 Jupyter notebook 中编译它时,它运行良好,但是当我在 Spyder IDE 中运行代码时,我得到一个错误。
def search_func(sheetname):
def insider(f):
file = openpyxl.load_workbook("Excelfile.xlsx")
current_sheet = file[sheetname]
f(current_sheet)
return insider
@search_func('Passwords')
def Longin(current_sheet):
Name = User_name.get() + str(Password.get())
for i in range(1,current_sheet.max_row +1):
for j in range(1,current_sheet.max_column+1):
if current_sheet.cell(i,j).value == Name:
print("Hello")
我得到的错误是“Longin() 缺少 1 个必需的位置参数:'current_sheet'”
任何人都可以帮助我吗?
珍惜你的时间。
干杯
解决方案
推荐阅读
- angular - Angular intercept catcherror 还会捕获除 404 之外的其他错误,并阻止应用按原样工作
- java - PHONE_STATE 接收器不与基于上下文的接收器一起使用
- python-3.x - 没有使用 python boto3 获取所有 aws 实例 - 保留问题
- swift - 在 SwiftUI 中动态添加元素到 VStack
- bash - 估计大文本文件的大小
- performance - webgl 不能在集成显卡上的一次 drawcall 中绘制太多图元
- ios - IOS 在应用程序拒绝问题 - 指南 2.1 - 性能 - 应用程序完整性
- node.js - 在猫鼬中删除文档时出现UnhandledPromiseRejectionWarning
- amazon-web-services - 如何通过 CloudFormation YAML 将堆栈导出的现有 S3 存储桶导入另一个堆栈
- python - 在 Log N 时间内设计一个算法