Skip to content

Instantly share code, notes, and snippets.

@kokimame
Last active May 6, 2020 22:25
Show Gist options
  • Select an option

  • Save kokimame/a63b1f82b9d5629c364333ecaf924161 to your computer and use it in GitHub Desktop.

Select an option

Save kokimame/a63b1f82b9d5629c364333ecaf924161 to your computer and use it in GitHub Desktop.
Remember there are many different whitespaces. 'NARROW NO-BREAK SPACE' gave me a hard time about debugging.
# On Chrome, most of them are recognized as 'SPACE' but Python differentiates this.
chars = [
(' ', 'CHARACTER TABULATION'),
(' ','SPACE'),
(' ','NO-BREAK SPACE'),
(' ', 'CGHAM SPACE MARK'),
(' ', 'EN QUAD'),
(' ', 'EM QUAD'),
(' ','EN SPACE'),
(' ', 'EM SPACE'),
(' ', 'THREE-PER-EM SPACE'),
(' ', 'FOUR-PER-EM SPACE'),
(' ', 'SIX-PER-EM SPACE'),
(' ', 'FIGURE SPACE'),
(' ', 'PUNCTUATION SPACE'),
(' ', 'THIN SPACE'),
(' ', 'NARROW NO-BREAK SPACE'),
(' ', 'MEDIUM MATHEMATICAL SPACE'),
(' ', 'IDEOGRAPHIC SPACE'),
]
for i, (char, name) in enumerate(chars):
if i == 0: print(' ', end='')
print(f'{ord(char):6d}', end='')
print()
for char, name in chars:
print(f'{ord(char):6d}', end='')
for c, n in chars:
if c == char: print(f' o', end='')
else : print(f' x', end='')
print()
print("\N{THIN SPACE}")
print(ord(' '), ord(' '))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment