开发者社区> 问答> 正文

python for语句怎么写

python for语句怎么写

展开
收起
云计算小粉 2018-05-10 20:10:51 2762 0
2 条回答
写回答
取消 提交回答
  • 不懂的太多

    Python循环语句

    • for语句
    words = ['aaa', 'bbb', 'ccc']
    for w in words:
        print(w)
    
    2022-04-06 08:50:33
    赞同 展开评论 打赏
  • 阿里云大学导师

    您好,参考示例如下:

    !/usr/bin/python

    -- coding: UTF-8 --

    for letter in 'Python': # 第一个实例
    print '当前字母 :', letter

    fruits = ['banana', 'apple', 'mango']
    for fruit in fruits: # 第二个实例
    print '当前水果 :', fruit

    print "Good bye!"

    2019-07-17 22:22:58
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
From Python Scikit-Learn to Sc 立即下载
Data Pre-Processing in Python: 立即下载
双剑合璧-Python和大数据计算平台的结合 立即下载

相关实验场景

更多