File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -549,7 +549,20 @@ \subsection{Strings \label{strings}}
549549
550550Two string literals next to each other are automatically concatenated;
551551the first line above could also have been written \samp {word = 'Help'
552- 'A' }; this only works with two literals, not with arbitrary string expressions.
552+ 'A' }; this only works with two literals, not with arbitrary string
553+ expressions:
554+
555+ \begin {verbatim }
556+ >>> 'str' 'ing' # <- This is ok
557+ 'string'
558+ >>> string.strip('str') + 'ing' # <- This is ok
559+ 'string'
560+ >>> string.strip('str') 'ing' # <- This is invalid
561+ File "<stdin>", line 1
562+ string.strip('str') 'ing'
563+ ^
564+ SyntaxError: invalid syntax
565+ \end {verbatim }
553566
554567Strings can be subscripted (indexed); like in \C {}, the first character
555568of a string has subscript (index) 0. There is no separate character
@@ -853,6 +866,7 @@ \section{\keyword{if} Statements \label{if}}
853866statement. For example:
854867
855868\begin {verbatim }
869+ >>> # [Code which sets 'x' to a value...]
856870>>> if x < 0:
857871... x = 0
858872... print 'Negative changed to zero'
You can’t perform that action at this time.
0 commit comments