Python2和Python3的差别很大

Python3学习笔记2.
 Python2和Python3的差别很大

按照教程,写了一段代码,结果总报错:
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?
Statements must be separated by newlines or semicolonsPylance

查了半天没找到啥原因,最后赫然发现,原来:
Python2到Python3,很多基本的函数接口变了,甚至有些库或函数被去掉或改名了 

在Python 3.x中,print是函数,这意味着需要编写print (a)而不是print a,除此之外,它的工作方式和语句差不多。


00002-3546432633.png
发表评论 / Comment

提示:本文章评论功能已关闭