fork download
  1. print("="*40)
  2. print("工具介绍(使用循环)")
  3.  
  4. index = 1
  5. # 给 tools 赋值一个列表(示例数据,可根据需要修改)
  6. tools = ["标注工具", "清洗工具", "可视化工具"]
  7.  
  8. for tool in tools:
  9. description = f"工具:{tool}—适用于数据标注"
  10. # 移除多余的末尾引号
  11. print(f"{index}.{description}")
  12. # 只保留一句递增语句
  13. index += 1
  14.  
  15. print("\n循环遍历完成!总共输出了", len(tools), "个工具的介绍。")
  16. print("="*40)
Success #stdin #stdout 0.1s 14108KB
stdin
Standard input is empty
stdout
========================================
工具介绍(使用循环)
1.工具:标注工具—适用于数据标注
2.工具:清洗工具—适用于数据标注
3.工具:可视化工具—适用于数据标注

循环遍历完成!总共输出了 3 个工具的介绍。
========================================