python - 如何访问函数结果中的记录或 frecord 变量,以便我可以使用它来函数提交?
问题描述
我试图使记录变量成为全局变量,之后,我试图在提交函数中使用它,但它给出了一个错误“未定义记录”。谁能帮我了解一下情况?
下面我有两个函数(result
和submit
),并且记录变量基本上在结果中有一些值,我想在提交中访问它。任何人都可以帮忙吗?
def submit(): ## this function will use to add stock.
for i in f_record: (SUBMIT FUNCTION )
for j in i:
if(j==name1.get()):
p=int(i[3]) * quantity1
price=p
def result(): # This function will use to see if the stock is added or not. Also to see the present stock (RESULT FUNCTION)
stock=sqlite3.connect('Super Store Stock')
c=stock.cursor()
c.execute('SELECT * FROM y') ##this will use to select all elements from table we have created
global record
record=c.fetchall()
stock.commit()
stock.close()
return
解决方案
推荐阅读
- angular - 如何从Angular 6中的父组件调用子组件的方法
- r - 为特定值添加面板数据序列
- google-cloud-platform - 如何通过服务帐户使用 gcloud?
- wordpress - Wordress 前端帖子类别数组
- sha1 - 我正在使用 C# 编写 3DES(使用 SHA1 HASH)加密算法。密钥大小错误
- node.js - 使用 node.js 调用 Wikipedia Api 时出现问题
- c++ - 为什么我的删除节点功能实际上并未删除节点?
- c# - 以编程方式创建数据透视表
- javascript - 将 C# 变量传递给 HTML 按钮
- r - 按数字列出索引和一些元素NULL,如何转换为数据框?