Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
\b
#3
i wrote a program that needed to convert human input to their binary rquivalent character code.  if the human types \ and r which results in a string of length 2 with \r in it. then my code converts that to a carriage return, the eqivalent of chr(13).  i made this handle all the sequences seen in man ascii as done in most Linux and most Unix.  these are codes from 7 to 13.  it also supports the sequences that begin with ^ making ^J be character code 10 (newline) and ^[ be character code 27 (escape).  i also added sequence \xNN where NN is interpreted as hexadecimal (documented in my code as "cetal") and the sequence \oMNN where MNN is interpreted as octal.  i wanted to add support for binary by doing \bNNNNNNNN but \b was already used (for character code 8, backspace).

the program takes the first argument as a screen (the screen program) session name and the remaining arguments as input to that screen session.  there is also a program to launch a background screen session (detached) with the specified name (required) and specified screen size (optional, default to the size this command is run in).

it also has support for \dMNN to interpret MNN as a decimal number for a character code as well as \MNN (digits 0, 1, 2, or 3 follow the \ character) as a traditional octal form.  letters may be given in either upper or lower case for all sequences.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply


Messages In This Thread
\b - by Skaperen - Dec-03-2017, 04:07 AM
RE: \b - by ezdev - Dec-09-2017, 07:47 PM
RE: \b - by Skaperen - Dec-10-2017, 03:59 AM
RE: \b - by ezdev - Dec-10-2017, 04:22 AM
RE: \b - by Skaperen - Dec-14-2017, 04:08 AM
RE: \b - by Skaperen - Dec-16-2017, 03:03 AM

Forum Jump:

User Panel Messages

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