• print语法使用
    python2.7 >>> print “hello word!”
    python3.7>>> print(“hello word!”)
    Python2.7和Python3.7的区别

  • raw_input()和input()
    python2.7>>> raw_input()接收字符串string,input()接收数字int /flot
    python3.7>>> 仅存在input(),接收任意格式,返回string

  • Python2.7中cmp(x,y)函数用于比较2个对象,如果 x < y 返回 -1, 如果 x == y 返回 0, 如果 x > y 返回 1
    Python3.7中cmp()已经不存在了,如果你需要实现比较功能,需要引入 operator 模块,适合任何对象
    Python2.7和Python3.7的区别

  • Python 2.7中不等于有两种写法 != 和 <>
    Python 3.7中不等于的写法去掉了<>, 只有!=一种写法
    Python2.7和Python3.7的区别

Mac下安装配置Python2和Python3,点击????链接

https://blog.csdn.net/tyh_keephunger/article/details/103737390

Mac终端Python2和Python3相互切换使用配置,点击????链接

https://www.cnblogs.com/tangdou-tangguo/p/11653033.html

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-01-01
  • 2022-12-23
  • 2021-04-07
  • 2022-12-23
  • 2021-10-16
  • 2021-09-13
猜你喜欢
  • 2022-12-23
  • 2021-06-16
  • 2021-12-21
  • 2021-06-21
  • 2022-12-23
相关资源
相似解决方案