Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 758833
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T15:31:35+00:00 2026-05-14T15:31:35+00:00

I was experimenting with ‘\’ characters, using ‘\a\b\c…’ just to enumerate for myself which

  • 0

I was experimenting with ‘\’ characters, using ‘\a\b\c…’ just to enumerate for myself which characters Python interprets as control characters, and to what. Here’s what I found:

\a - BELL
\b - BACKSPACE
\f - FORMFEED
\n - LINEFEED
\r - RETURN
\t - TAB
\v - VERTICAL TAB

Most of the other characters I tried, ‘\g’, ‘\s’, etc. just evaluate to the 2-character string of a backslash and the given character. I understand this is intentional, and makes sense to me.

But ‘\x’ is a problem. When my script reaches this source line:

val = "\x"

I get:

ValueError: invalid \x escape

What is so special about ‘\x’? Why is it treated differently from the other non-escaped characters?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T15:31:35+00:00Added an answer on May 14, 2026 at 3:31 pm

    There is a table listing all the escape codes and their meanings in the documentation.

    Escape Sequence    Meaning                        Notes
    \xhh               Character with hex value hh    (4,5)
    

    Notes:

    4. Unlike in Standard C, exactly two hex digits are required.
    5. In a string literal, hexadecimal and octal escapes denote the byte
    with the given value; it is not necessary that the byte encodes a character
    in the source character set. In a Unicode literal, these escapes denote a
    Unicode character with the given value.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been experimenting with woopra.com A web analytics tool. Which requires a piece
Experimenting using different approaches and reducing code maintenance I have ended up using reflection
experimenting with Visitor pattern and generic method I found a kind of discrepancy in
been experimenting with unordered list UL and i have seem varios examples of using
I'm currently experimenting with using WCF Data Services as a way to open up
I've just started experimenting with CodeContracts in .NET 4 on an existing medium-sized project,
I've just begun experimenting with nested masters in MVC2. I'm not quite sure why
I am experimenting with .NET Code Contracts. The following code runs just fine when
While experimenting with this question on collections in Spring.NET , I discovered that Spring
I'm currently experimenting with build script, and since I have an ASP.net Web Part

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.