zoukankan      html  css  js  c++  java
  • day11——考试python2和python3的区别

    python:优美,清晰,简单。

    区别:

    ① python2x:源码混乱、重复代码较多,冗余
         python3x:源码规范,崇尚优美清晰,简单

    ②   python3x               print('内容')

      python2x                print('内容')或者print '内容'

    ③    python3x        默认编码:utf-8

      python2x        默认编码:ascii

    如果要print中文,需要指定编码    # -*- encoding:utf-8 -*-

    ④   用户输入: input

        python2x: raw_input()

              input()   相当于eva1

        python3x: input()

    ⑤      python2x:   range在2x里面--------->    数字列表

              xrange--------------------->   可迭代对象

         python3x:   range  -------------------->   可迭代对象

  • 相关阅读:
    验证码
    九九乘法表
    P121 6.7 第一题和第二题
    二分搜索法(转载自vanezkw)
    用for循环打印菱形
    用while循环语句计算1!+2!+……20!之和
    数的阶乘之和
    9.29
    doGet与doPost的区别
    JavaScript习题
  • 原文地址:https://www.cnblogs.com/-li926/p/9483641.html
Copyright © 2011-2022 走看看