Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
a8f6f1e2
Commit
a8f6f1e2
authored
Dec 20, 2009
by
Ezio Melotti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed capitalization and markup; added imports in the example
parent
7e5229c3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
3 deletions
+6
-3
Doc/library/tokenize.rst
Doc/library/tokenize.rst
+6
-3
No files found.
Doc/library/tokenize.rst
View file @
a8f6f1e2
...
...
@@ -94,16 +94,19 @@ function it uses to do this is available:
(as a string) and a list of any lines (not decoded from bytes) it has read
in.
It detects the encoding from the presence of a
utf-8 bom
or an encoding
cookie as specified in
pep-0263. If both a bom
and a cookie are present,
It detects the encoding from the presence of a
UTF-8 BOM
or an encoding
cookie as specified in
:pep:`263`. If both a BOM
and a cookie are present,
but disagree, a SyntaxError will be raised.
If no encoding is specified, then the default of
'utf-8'
will be returned.
If no encoding is specified, then the default of
``'utf-8'``
will be returned.
Example of a script re-writer that transforms float literals into Decimal
objects::
from tokenize import tokenize, untokenize, NUMBER, STRING, NAME, OP
from io import BytesIO
def decistmt(s):
"""Substitute Decimals for floats in a string of statements.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment