python - 如何在python中查看文件的内容
问题描述
我正在尝试在我的文件中添加一个新帐户,该帐户已经包含其他帐户的用户名和密码,之后我只想查看新添加的帐户或文件的内容,但彼此之间有一定的距离:
编号 账户名 用户名 密码
1 Facebook 管理员 123admin
2 谷歌用户 123user
以下是我在文件中添加新帐户的代码:
def Add_account():
account = input("\nEnter the name of the account: ")
username = input(f"Enter the username of your {account}: ")
password = input(f"Enter the password of your {account}: ")
ask = input(f"Do you want to save {account} credentials? [Y|N]: ")
if new_ask == "Y":
with open("info.txt", "a") as file:
file.write("\n" + encrypt(account) + ":" + encrypt(username) + ":" + encrypt(password))
file.close()
Add_account()
如何仅在我的文件中查看新帐户?
解决方案
推荐阅读
- java - 重新启动后的警报管理器在意图时显示错误 NullPointerException
- javascript - High Chart 旭日形图从内层开始数据
- javascript - 尝试使用 onblur 进行内联验证,但不会出现消息
- assembly - 汇编 (emu8086) 反转十进制文本
- javascript - 三元滤波函数
- mysql - MySQL 错误代码 1265:我的 csv 数据有什么问题?
- python - pyqt5 qthread由于未知原因崩溃,如何正确使用?
- jsp - 为什么我在tomcat中部署我的javaweb项目后显示404
- postgresql - 如何在 Slick 中的一系列数据库查询之间包含 scala 操作?
- python - Tagging/annotating every frame in the video with the activity performed using OpenCV python