2

Is there an equivalent Python function to JavaScript's String.fromCharCode?

The use case is a string generator and I'd like to use the ASCII decimal or hex values to generate the characters (numbers, symbols, upper/lower letters).

JS example:

String.fromCharCode(97) // Gives 'a'
mrk
  • 8,059
  • 3
  • 56
  • 78
daChi
  • 43
  • 5

1 Answers1

6

The built-in chr function handles this (ord performs the inverse transformation)

ShadowRanger
  • 143,180
  • 12
  • 188
  • 271