0

Characters in Python?

Im coming from java background, How to declare a character in Python?

12th Apr 2017, 4:06 PM
Arun
Arun - avatar
3 Réponses
+ 4
Char in Python is just a one-element string. No separate data type for that. ch = 'a' or ch = "a"
12th Apr 2017, 4:38 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
0
ch='string'[3] print(ch) print(type(ch))
12th Apr 2017, 5:43 PM
Андрей
0
can you try: n = chr(97) # 'a' in ascii code print(n) output: 'a'
13th Apr 2017, 1:40 AM
Edgardo
Edgardo - avatar