Aug-04-2018, 10:20 AM
I would say:
def myord(c): if len(c) == 2 and c[0] == '^': return ord(c[1]) - ord('@') else: return ord(c) print(myord('^C'))Links: caret notation, ascii control characters.