mirror of
https://github.com/kennethreitz/dive-into-python3.git
synced 2026-06-05 23:10:17 +00:00
quoting attribute values is a hard habit to break
This commit is contained in:
+1
-1
@@ -9,7 +9,7 @@ out = open(output_file, 'w', encoding="utf-8") # encoding argument! important!
|
||||
for line in open(input_file).readlines():
|
||||
# replace entities with Unicode characters
|
||||
for e in re.findall('&(.+?);', line):
|
||||
if e in ('lt', 'gt', 'amp'):
|
||||
if e in ('lt', 'gt', 'amp', 'nbsp'):
|
||||
continue
|
||||
n = html.entities.name2codepoint.get(e)
|
||||
if not n:
|
||||
|
||||
Reference in New Issue
Block a user