Language Syntax

Physical lines — Python syntax

Physical lines are terminated by standard newline sequences or end of input. Python source parsing normalizes these newline forms; a physical line need not end a logical statement.

Formal Syntax & Structure

python syntaxpython
physical_line = source characters + line ending (LF, CRLF, CR, or EOF)

Working Example

Example Snippetpython
source='a=1\r\nb=2\rc=3\n'ns={}exec(compile(source,'<source>','exec'),ns)print((ns['a'],ns['b'],ns['c']))
Python Reference