Home >Backend Development >Python Tutorial >Which key to press for line break in python

Which key to press for line break in python

anonymity
anonymityOriginal
2019-06-11 11:11:3012028browse

Which key to press for line break in python?

Which key to press for line break in python

Add '\' at the end of a line, for example:

data11=data21=data31=data41=data51=data61=data71=data81=data91= data101=data111=data121=data131=data141=data151=data161=data171=data181=data191=data201=data211=pd.DataFrame(columns['w','ka','period'])

Above This line of program is too long. Please wrap the line and continue writing as follows:

data11=data21=data31=data41=data51=data61=data71=data81\
=data91=data101=data111=data121=data131=data141\
=data151=data161=data171=data181=data191=data201=data211\ 
= pd.DataFrame(columns=['w','ka','period'])

If connected by commas, you don’t need to add '\', for example:

datas1 = [data11, data21, data31, data41, data51, data61, 
data71, data81, data91, data101, data111,data121,
data131,data141,data151,data161,data171,
data181,data191,data201,data211]

For example:

>>> print 'aaa'; \
... print 'bbb'; \
... print 'ccc'

Note the use of ;. 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.

Another note:

\: Characters connecting the current line and the next line

/: Division

//: Forced integer division

%:Remainder

The above is the detailed content of Which key to press for line break in python. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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