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 1006317
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T08:26:25+00:00 2026-05-16T08:26:25+00:00

str = r’c:\path\to\folder\’ # my comment IDE: Eclipse Python2.6 When the last character in

  • 0
str = r'c:\path\to\folder\'   # my comment
  • IDE: Eclipse
  • Python2.6

When the last character in the string is a backslash, it seems like it will escape the last single quote and treat my comment as part of the string. But the raw string is supposed to ignore all escape characters, right? What could be wrong? Thanks.

  • 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-16T08:26:26+00:00Added an answer on May 16, 2026 at 8:26 am

    Raw string literals don’t treat backslashes as initiating escape sequences except when the immediately-following character is the quote-character that is delimiting the literal, in which case the backslash does escape it.

    The design motivation is that raw string literals really exist only for the convenience of entering regular expression patterns – that is all, no other design objective exists for such literals. And RE patterns never need to end with a backslash, but they might need to include all kinds of quote characters, whence the rule.

    Many people do try to use raw string literals to enable them to enter Windows paths the way they’re used to (with backslashes) – but as you’ve noticed this use breaks down when you do need a path to end with a backslash. Usually, the simplest solution is to use forward slashes, which Microsoft’s C runtime and all version of Python support as totally equivalent in paths:

    s = 'c:/path/to/folder/'
    

    (side note: don’t shadow builtin names, like str, with your own identifiers – it’s a horrible practice, without any upside, and unless you get into the habit of avoiding that horrible practice one day you’ll find yourseld with a nasty-to-debug problem, when some part of your code tramples over a builtin name and another part needs to use the builtin name in its real meaning).

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

Sidebar

Ask A Question

Stats

  • Questions 540k
  • Answers 540k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer SubSonic is able to do something like this. http://subsonicproject.com/docs/Linq_Deletes May 17, 2026 at 2:29 am
  • Editorial Team
    Editorial Team added an answer Looking in reflector you can see the top of ChangeType(object,… May 17, 2026 at 2:29 am
  • Editorial Team
    Editorial Team added an answer In your second example query, are you certain you want… May 17, 2026 at 2:29 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

string str = one three; string::iterator it; string add = two ; Lets say
std::string str = string: const char* cstr = str.c_str(); str.clear(); //here, check if cstr
foreach (string str in TestWords) { //spam SqlCommand cmd6 = new SqlCommand(select count from
str_replace('Ê','',$line); Ain't working. Is there some special string that represents that?
char *str = malloc (14); sprintf(str, %s, one|two|three); char *token1, *token2, *token3; char *start
char *str = NULL; str = Operation(argv[1]); cout << Cal(str); Operation function return a
Using str.format() is the new standard for formatting strings in Python 2.6, and Python
var str = '0.25'; How to convert the above to 0.25?
NSMutableString *str = [[NSMutableString alloc] init]; Suppose str has right know a value me.
NSMutableString *str; //I have already done the allocation etc Suppose this str has some

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.