zoukankan      html  css  js  c++  java
  • python5

    print应用

    // 输出两行

    print "hahaha"

    print "hehehe"

    // 输出在同一行里

    print "hahaha",

    print "hehehe"

    // 输出到文件

    f = open("xxx.txt", "w")

    print >> f,"hahaha"

    f.close()

    控制流语句

    // if

    if True:

      print("True")

    elif not True:

      print("not True")

    else:

      pass// pass代表什么都不执行

    三元表达式:6 if 10<9 else 4

    // while

    while True:

      print("True")

    else:// while结束后再执行这

      print("end")

    // for

    for item in range(2):

      print (item)

    else:

      print(item)

    // break和continue的运用

    布尔值

    and、or、is、==、not

  • 相关阅读:
    从Python到Web开发
    源码安装缺少configure文件
    5
    4
    3
    2
    42
    1
    18
    41
  • 原文地址:https://www.cnblogs.com/dulianyong/p/10070867.html
Copyright © 2011-2022 走看看