我需要下面的文本文件,如下所示:
管理,使用taskManager.py注册用户,使用taskManager.py为将使用此程序的所有团队成员添加用户名和密码,2019年10月10日、2019年10月20日、209年10月20日、2022-10年6月25日、2022-10年6月25日、2022年10月10日、209年10月25日、2099年10月25日和2099年10月25日使用taskManager.py为每个团队成员添加用户名和密码,并运行月度报告。
需要以这种格式打印文件中的每一行:
任务:分配给:指定的管理日期:2019年10月10日到期日:2019年10月25日任务完成?没有任务描述:使用taskManager.py分配成员
这是我编写的代码,但我似乎不能正确地运行循环:
with open("tasks.txt", "r") as f:
list_string = f.read().split(", ")
print("______________________________")
for line in list_string:
print(f"Task:\t\t\t {line}\nAssigned to:\t\t\t {line}\nDate assigned:\t\t\t {line}\nDue date:\t\t\t {line}\nTask complete:\t\t\t {line}\nTask description:\n{line}")
print("____________________________")发布于 2022-03-12 07:23:43
读取面向线的数据的一般机制是:
with open('<your input file>') as infile:
for line in infile:
pass # process each line herehttps://stackoverflow.com/questions/71447685
复制相似问题