Hexo

Home Archives
2018-05-03
Python

ASCII ord() chr()

  1. ord() 和chr(), unichr()相反

    ord('A') : ‘A ‘ —> 65

    ord(u'\u2020') : return 8224

    chr(65) : 65 —> A

  2. ASCII code for ‘A’ is 65, ‘a’ is 97

1
2
3
4
5
6
7
8
9
10
11
>>> ord('A')
65

>>> ord('a')
97

>>> chr(65)
'A'

>>> chr(97)
'a'
  1. Note:

    if {A:1, B:2, ….}

    ord('A')-64

    注意最开始A为65,如果设定A为1,则 - 64

Share
Newer
math.log(243,3) problem
Older
191. Number of 1 Bits

Categories

  • Hexo
  • Java
  • Leetcode
  • Python
  • Shell Command
  • Uncategorized
  • Web
    • Back-end
      • Django
    • Front-end
  • python

Tags

  • Bit Manipulation
  • Git
  • Set

Tag Cloud

Bit Manipulation Git Set

Archives

  • September 2018
  • July 2018
  • June 2018
  • May 2018
  • April 2018

Recent Posts

  • Leetcode 经验
  • Establish a django project
  • Set Max and Min in Python
  • Build a html page
  • HTML Basics
© 2018 John Doe
Powered by Hexo
Home Archives