Whether to end each line of python with a semicolon or a semicolon

Source: Internet
Author: User

Whether to end each line of python with a semicolon or a semicolon

If you are familiar with other computer languages, you may get used to ending each line with a semicolon.

PythonNo. You can add a semicolon at the end of each sentence, but it does not work. Of course, if there are multiple sentences in the same row, you must add a semicolon to separate each sentence.

zhangjies-MacBook-Air:~ zhangjie$pythonPython 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 darwinType "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 a1>>> a = 1; print a;1>>> 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.