fork download
  1. tools = ["LabelMe", "VIA", "CVAT"]
  2. print("=" * 40)
  3. print("工具介绍(使用循环)")
  4. # 使用循环遍历列表中的每个工具
  5. index = 1 # 增加序号变量
  6. for tool in tools:
  7. # 生成介绍语句
  8. description = f"工具:{tool} —— 适用于数据标注"
  9. # 带序号输出,更清晰
  10. print(f"{index}. {description}")
  11. index+=1 # 序号递增
  12. # 额外输出循环结束提示
  13. print("\n循环遍历完成!总共输出了", {len(tools)}, "个工具的介绍。")
Success #stdin #stdout 0.11s 13904KB
stdin
Standard input is empty
stdout
========================================
工具介绍(使用循环)
1. 工具:LabelMe —— 适用于数据标注
2. 工具:VIA —— 适用于数据标注
3. 工具:CVAT —— 适用于数据标注

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