ASCII码

ascii码操作如下:

chr:数字转为字符

ord:字符转为数字

 1 >>>chr(65)  # 数字转为字符
 2 'A'
 3 >>>chr(40)
 4 '('
 5 >>>upper_letters = list(chr(x) for x in range(65,91))
 6 >>>lower_letters = list(chr(x) for x in range(97,123))
 7 >>>number = list(chr(x) for x in range(48,58))
 8 >>>
 9 >>>print(*upper_letters)
10 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
11 >>>print(*lower_letters)
12 a b c d e f g h i j k l m n o p q r s t u v w x y z
13 >>>print(*number)
14 0 1 2 3 4 5 6 7 8 9
15 >>>
16 >>>
17 >>>
18 >>>ord('a')  # 字符转为数字
19 97
20 >>>ord(')')
21 41

 

ascii表

 

posted @ 2017-07-27 16:15  fat39  阅读(856)  评论(0编辑  收藏  举报