【发布时间】:2017-05-29 09:55:49
【问题描述】:
我正在学习如何在 Python 上使用 TinyDB,并且我已经掌握了基础知识(添加、删除、更新等)。但现在我正在尝试从数据库中检索特定值。我正在使用的代码在这个方法中:
def showpassword():
show = userdb.get(where("username") == txtname.get())
txtshow.insert(0, show)
当我运行该方法时,它会显示如下输出:
{'username': 'John', 'surname': 'Doe'}
我怎样才能得到它,这样我就可以只显示用户的名字或姓氏,而没有任何括号?
【问题讨论】:
标签: python-3.x tkinter tinydb