티스토리 뷰

공부

[Python] char + 1

승가비 2020. 6. 27. 22:45
728x90
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

 

728x90
댓글