python2和python3的区别:

  • python2获取的是整数 python3获取的是浮点数
  • print函数:(Python3中print为一个函数,必须用括号括起来;Python2中print为class)

  • python2:

print 'Python', python_version()
print 'Hello, World!'
print('Hello, World!')
print "text", ; print 'print more text on the same line'

运行结果:
Python 2.7.6
Hello, World!
Hello, World!
text print more text on the same line
  • python3:
print('Python', python_version())
print('Hello, World!')
print("some text,", end="")
print(' print more text on the same line')

运行结果:
Python 3.4.1
Hello, World!
some text, print more text on the same line
  • 通过input()解析用户的输入:

    • Python3中input得到的为str;
    • Python2的input的到的为int型,Python2的raw_input得到的为str类型
  • python除法:
    • Python3中/表示真除,//表示地板除(结果取整);
    • Python2中俩整数相除/表示地板除(带上小数点/表示真除),//同样表示地板除

最新文章

  1. Quartz实现任务调度
  2. BSTR 的奥秘
  3. AngularJS 2 VS Code Linter环境设置
  4. oracle的substr函数的用法
  5. Myeclipse的show in breadcrumb
  6. struts2回显指定的错误信息
  7. hdu 4521 小明系列问题——小明序列(线段树 or DP)
  8. Twenty Questions
  9. ES6/ES2015核心内容
  10. java实现文件夹(包括其中的子文件夹、子文件)的复制——递归
  11. 点击按钮如何改变当前窗口的url
  12. 002dayPython学习编码
  13. Problem A: 类的初体验
  14. OA与BPM的区别
  15. 【CF944G】Coins Exhibition DP+队列
  16. linux中用composer安装yii框架
  17. 使用web页面实现oracle的安装和测试
  18. Hibernate 注解之 @Temporal
  19. 解决 The word is not correctly spelled问题
  20. EBS通过SQL查找所有的定时请求

热门文章

  1. 搭建maven本地仓库,idea应用本地maven仓库
  2. Python基础(十四)
  3. RMAN备份归档日志ORA-19575
  4. Openshift创建Router和Registry
  5. Scala 学习笔记之函数(3)
  6. 快学Scala 第二十课 (trait的构造顺序)
  7. 安卓tab,viewPaper以及frament的使用
  8. 定期从Docker上部署的MySQL备份数据
  9. spring boot项目下的application.properties中的logging.level设置日志级别
  10. Web Storage和cookie的区别——每日一题20190629