+ \ operator in Python

What does the + \ operator do in Python?

I came across this piece of code -

rows=urllib2.urlopen('http://ichart.finance.yahoo.com/table.csv?'+\
's=%s&d=11&e=26&f=2006&g=d&a=3&b=12&c=1996'%t +\
'&ignore=.csv').readlines( )

and cannot find any links explaining this.

+3
source share
4 answers

+- addition. \at the end of the line continues the current statement or expression on the next line.

+18
source

NB Continuation \in this case is not necessary, since the expression is in parentheses. Python is smart enough to know that a line continues until all the brackets, brackets, and brackets are balanced.

- , . , , , , , .

+ - Python .

% +, :

rows=urllib2.urlopen('http://ichart.finance.yahoo.com/table.csv?'
                     's=%s&d=11&e=26&f=2006&g=d&a=3&b=12&c=1996' 
                     '&ignore=.csv' % t).readlines( )
+11

, +, \

+7

rows=urllib2.urlopen('http://ichart.finance.yahoo.com/table.csv?'
                     's=%s&d=11&e=26&f=2006&g=d&a=3&b=12&c=1996'
                     '&ignore=.csv'%t).readlines()

, ,

+1

Source: https://habr.com/ru/post/1751143/


All Articles