p.p1 { margin: 0.0px 0.0px 2.0px 0.0px; font: 14.0px "PingFang SC Semibold"; color: #454545 }
span.s1 { font: 14.0px "PingFang SC" }
span.s2 { font: 14.0px Helvetica }
如果熟悉其他计算机语言,可能会习惯于每行以分号结束。
python则不用,可以在每句末尾加上分号,但不会有任何作用。当然如果同一行内有多句代码,则每句之间是需要加上分号用来分割的。
zhangjies-MacBook-Air:~ zhangjie$python Python 2.7.9 (default, Jul 14 2015, 12:18:43) [GCC 4.2.1 Compatible Apple LLVM 6.1.0 (clang-602.0.49)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> print "hello world!" hello world! >>> print "hello world!"; hello world! >>> a = 1 print a File "<stdin>", line 1 a = 1 print a ^ SyntaxError: invalid syntax >>> a = 1; print a 1 >>> a = 1; print a; 1 >>>
时间: 2024-10-09 11:02:23