How to wrap input commands in python interactive mode

Release: 2019-07-06 09:51:11
Original
15602 people have browsed it

How to wrap input commands in python interactive mode

Let me first introduce to you the method of entering newline/entering multi-line commands in python interactive mode

换行方法 \
如:
>>> print 'aaa'; \
 ... print 'bbb'; \
 ... print 'ccc'
注意;号的使用。
Copy after login

Python itself does not require the end of the statement and the interval; sign , but the ; sign must be used when breaking a line. The last line is not required to have a ; sign, and there will be no error if added.

Let’s take a look at how to wrap the line in the interactive command line of python

>>> is the input prompt of python, and pressing Enter will end the input. So how to enter more than two statements?

Line break method\

>>> print 'aaa'; \
... print 'bbb'; \
... print 'ccc'
Copy after login

Pay attention to the use of ; sign. Python itself does not require the ; sign at the end of statements and intervals, but it must be used when breaking a line. The last line is not required to have a ; sign, and there will be no error if added.

For more Python related technical articles, please visit the Python Tutorial column to learn!

The above is the detailed content of How to wrap input commands in python interactive mode. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!