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

  • Home
  • SEARCH
  • 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 150629
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T09:19:15+00:00 2026-05-11T09:19:15+00:00

Technically, any odd number of backslashes, as described in the documentation . >>> r’\’

  • 0

Technically, any odd number of backslashes, as described in the documentation.

>>> r'\'   File '<stdin>', line 1     r'\'        ^ SyntaxError: EOL while scanning string literal >>> r'\\' '\\\\' >>> r'\\\'   File '<stdin>', line 1     r'\\\'          ^ SyntaxError: EOL while scanning string literal 

It seems like the parser could just treat backslashes in raw strings as regular characters (isn’t that what raw strings are all about?), but I’m probably missing something obvious.

  • 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. 2026-05-11T09:19:16+00:00Added an answer on May 11, 2026 at 9:19 am

    The reason is explained in the part of that section which I highlighted in bold:

    String quotes can be escaped with a backslash, but the backslash remains in the string; for example, r'\'' is a valid string literal consisting of two characters: a backslash and a double quote; r'\' is not a valid string literal (even a raw string cannot end in an odd number of backslashes). Specifically, a raw string cannot end in a single backslash (since the backslash would escape the following quote character). Note also that a single backslash followed by a newline is interpreted as those two characters as part of the string, not as a line continuation.

    So raw strings are not 100% raw, there is still some rudimentary backslash-processing.

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

Sidebar

Related Questions

I am testing how big a collection could be in .Net. Technically, any collection
If I have a writable file with an ACL-rule of deny delete , any
After reading the documentation (http://stw.castleproject.org/Windsor.Installers.ashx) I've found a strange part: Although technically it's OK
Possible Duplicate: Technically why is processes in Erlang more efficient than OS threads? Any
I'm curious if there is way to digitally sign documents (technically any piece of
Is there any (technical) reason that C# requires all generic type parameters to be
I know it is customary, but why? Are there real technical reasons why any
Languages like C and even C# (which technically doesn't have a preprocessor) allow you
I am starting to develop an Eclipse plugin (technically, an OSGi plugin) and one
I have read that private variables in a base class are technically inherited by

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.