티스토리 뷰

공부

[Python] char + 1

seunggabi 승가비 2020. 6. 27. 22:45
chr(ord('b') + 1)

https://stackoverflow.com/questions/12797067/how-can-i-do-a-1-b-in-python

 

How can I do 'a' + 1 #=> 'b' in python?

I'm working on a project need this functionality very frequently 'b' + 1 #=> 'a' and 'b' - 1 #=> 'a' Now my solution is very tedious : str(unichr((ord('b')+ 1))) is there a more elegant ...

stackoverflow.com

 

'공부' 카테고리의 다른 글

[linux] check IP  (0) 2020.07.04
Failed to detect a valid hadoop home directory  (0) 2020.07.04
[Python] char + 1  (0) 2020.06.27
[Python] map(dict) put  (0) 2020.06.27
[Python] TypeError: Unicode-objects must be encoded before hashing (md5)  (0) 2020.06.27
[jenkins] build & sudo & nohup & pkill  (0) 2020.06.27
댓글
댓글쓰기 폼