Python Forum
Thread Rating:
  • 1 Vote(s) - 1 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ascii() (repr() in py2)
#1
the ascii() function in py3 (repr() in py2) converts only 3 ASCII control characters to mnemonic escape sequenes (e.g. '\t' and '\n' and '\r')  Python accepts these and others like '\a' and '\b' and '\v' and '\f' in string literals.  anyone know of a function to convert to all of them?

anyone know of a function to convert FROM all escape sequences (like source literal compiling does)?
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#2
The codecs module with unicode_escape?
Unless noted otherwise, code in my posts should be understood as "coding suggestions", and its use may require more neurones than the two necessary for Ctrl-C/Ctrl-V.
Your one-stop place for all your GIMP needs: gimp-forum.net
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Repr() function Valentina 3 3,353 Aug-22-2019, 11:28 AM
Last Post: perfringo
  str vs repr Skaperen 9 5,934 Jun-05-2017, 01:04 AM
Last Post: Skaperen
  when repr() fails Skaperen 8 6,568 May-03-2017, 02:48 AM
Last Post: Skaperen

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020