mirror of https://github.com/python/cpython
Further beautification of the example
This commit is contained in:
commit
db3dd8a6cc
|
@ -1334,13 +1334,16 @@ successive matches::
|
|||
if pos != len(s):
|
||||
raise RuntimeError('Unexpected character %r on line %d' %(s[pos], line))
|
||||
|
||||
>>> statements = '''\
|
||||
statements = '''\
|
||||
total := total + price * quantity;
|
||||
tax := price * 0.05;
|
||||
'''
|
||||
>>> for token in tokenize(statements):
|
||||
|
||||
for token in tokenize(statements):
|
||||
print(token)
|
||||
|
||||
The tokenizer produces the following output::
|
||||
|
||||
Token(typ='ID', value='total', line=1, column=8)
|
||||
Token(typ='ASSIGN', value=':=', line=1, column=14)
|
||||
Token(typ='ID', value='total', line=1, column=17)
|
||||
|
|
Loading…
Reference in New Issue