关于以下内容的评论:如何使用 Python 和文本文件构建数据库 | Hello World #9 https://www.raspberrypi.org/blog/how-to-build-databases-using-python-and-text-files-hello-world-9/用 Raspberry Pi 教学、学习和创造 2021年9月19日星期日 15:46:26 +0000 每小时 1 https://wordpress.org/?v=7.1.5 By: Rajib 作者:Clint https://www.raspberrypi.org/blog/how-to-build-databases-using-python-and-text-files-hello-world-9/#comment-1513490 周日, 2019年7月21日 14:41:53 +0000 https://www.raspberrypi.org/?p=52439#comment-1513490 用 pickle 或 json 存储数据会比 csv 更好吗? ]]> 作者:Annoying Terminology https://www.raspberrypi.org/blog/how-to-build-databases-using-python-and-text-files-hello-world-9/#comment-1513456 周日, 2019年7月21日 03:49:39 +0000 https://www.raspberrypi.org/?p=52439#comment-1513456 回复史蒂夫·威廉姆斯.

创建
读取
Update
删除

]]>
作者:ileana https://www.raspberrypi.org/blog/how-to-build-databases-using-python-and-text-files-hello-world-9/#comment-1512886 周一, 2019年7月15日 06:31:14 +0000 https://www.raspberrypi.org/?p=52439#comment-1512886 回复lou.

哪位作者的书最适合用于 Python?

]]>
作者:lou https://www.raspberrypi.org/blog/how-to-build-databases-using-python-and-text-files-hello-world-9/#comment-1512625 周三, 2019年7月10日 02:18:06 +0000 https://www.raspberrypi.org/?p=52439#comment-1512625 很棒的文章!真希望我上学时也有这样酷的小项目。

我添加了几处改进:
在最上方:
使用 `open(filename, 'a')`:`pass`
# 如果文件不存在,则创建该文件。

current_ID = data[-1].get("ID")
# `[:-1]`——切片操作会返回一个不包含 `get` 方法的列表;`[-1]` 则会返回列表末尾的元素。

search_term = str(input("你想搜索什么?")).lower()
以及
if search_term in str(val).lower():
# 如果尝试按 ID 或年份进行搜索,你会遇到错误,因为整数对象并不具备 `.lower()` 方法。

]]>
作者:Steve Williams https://www.raspberrypi.org/blog/how-to-build-databases-using-python-and-text-files-hello-world-9/#comment-1512615 周二, 2019年7月9日 19:29:59 +0000 https://www.raspberrypi.org/?p=52439#comment-1512615 在开发数据库应用程序时,我发现记住缩写词 CRUD——创建、报告、更新、删除——非常有帮助。
一个人应当能够:
– 创建新记录——如果你没有这样做,那么你又如何将数据录入数据库应用程序?
– 报表记录信息——如果你没有这么做,那为什么还要存储这些记录呢?
– 更新记录——如果未进行更新,数据就会逐渐过时(事物总是在变化!)
– 删除记录 – 否则数据库应用程序的存储会不断增长! ]]>
作者:Martin Bonner https://www.raspberrypi.org/blog/how-to-build-databases-using-python-and-text-files-hello-world-9/#comment-1512607 周二, 2019年7月9日 17:31:12 +0000 https://www.raspberrypi.org/?p=52439#comment-1512607 ISBN 不是图书馆数据库的良好键。问题:

– ISBN仅适用于某一特定版本的书籍——而图书馆(包括个人图书馆)往往存在多本相同版本的书籍。
我想不出还有哪些其他问题,但相信一定还有不少。(让人们充分意识到现实世界数据的复杂性,始终是个明智的选择。)
在开发数据库应用程序时,我常常发现,牢记CRUD这四个字母——创建(Create)、报告(Report)、更新(Update)、删除(Delete)——会带来诸多益处。

我再也想不出还有什么问题了,但我相信肯定还有。(让人们意识到现实世界数据有多混乱,永远是个好主意。)

]]>