rawstring Questions

2

Solved

string raw_str = R"(R"(foo)")"; If I have R"()" inside a raw string, and that causes the parser to confuse. (ie., it thought the left most )" was the end of the raw string. How do I escape this...
Dome asked 21/3, 2018 at 21:15

3

Solved

You create raw string from a string this way: test_file=open(r'c:\Python27\test.txt','r') How do you create a raw variable from a string variable, such as path = 'c:\Python27\test.txt' test_fi...
Isochromatic asked 6/2, 2014 at 14:23

3

Apologies if this has been asked before, I did search for it but all hits seemed to be about python raw strings in general rather than regarding argparse. Anyways, I have a code where the us...
Canaigre asked 24/8, 2016 at 10:9

2

Solved

I know that you can create a multi-line string a few ways: Triple Quotes ''' This is a multi-line string. ''' Concatenating ('this is ' 'a string') Escaping 'This is'\ 'a string' I al...
Waylon asked 1/9, 2017 at 15:23

1

Solved

I am trying to give the file path in C# which contains special/escape characters. I am new to C#. please help me in defining the file path as raw string literals. Following is path (\t has s...
Loosetongued asked 28/12, 2016 at 9:49

2

Solved

The following program does not compile: #include <iostream> int main() { std::cout << R"RAW_STRING_LITERAL( hello world )RAW_STRING_LITERAL"; } error: raw string delimiter long...
Retaretable asked 4/8, 2015 at 20:4

3

Solved

The two characters )" terminate the raw string literal in the example below. The sequence )" could appear in my text at some point, and I want the string to continue even if this sequence is found...
Organic asked 18/5, 2015 at 16:10

4

Solved

I am confused here, even though raw strings convert every \ to \\ but when this \ appears in the end it raises error. >>> r'so\m\e \te\xt' 'so\\m\\e \\te\\xt' >>> r'so\m\e...
Hepzi asked 23/6, 2012 at 8:40

2

Solved

I don't understand how raw string literals work. I know that when using r it ignores all specials, like when doing \n it treats it as \n and not as a new line. but then I tried to do this: x...
Mucilaginous asked 10/5, 2015 at 22:11

2

Solved

In Python, I have a string like this: '\\x89\\n' How can I decode it into a normal string like: '\x89\n'
Protist asked 16/6, 2014 at 11:16

3

Solved

val name = "mike" val str = """Hi, {name}!""" println(str) I want it output the str as Hi, mike!, but failed. How to do this?
Cutworm asked 26/7, 2010 at 17:6

2

C++11 introduced the raw string literals which can be pretty useful to represent quoted strings, literals with lots of special symbols like windows file paths, regex expressions etc... std::string ...
Lucan asked 30/1, 2014 at 15:33

1

Solved

I am making a class that relies heavily on regular expressions. Let's say my class looks like this: class Example: def __init__(self, regex): self.regex = regex def __repr__(self): return 'E...
Theseus asked 8/12, 2012 at 14:48

1

Solved

My Python version is: ~$ python --version Python 2.6.6 I tried following in Python (I wants to show all): 1: \ use as escape sequence >>> str('Let\'s Python') "Let's Python" 2: ...
Notify asked 2/12, 2012 at 13:24

3

Solved

In Python, I can prefix an r to a string literal (raw string) to tell the interpreter not translate special characters in the string: >>> r"abc\nsdf#$%\^" r"abc\nsdf#$%\^" Is there a wa...
Coadjutress asked 15/6, 2012 at 0:53

2

Solved

I'm trying to parse a json response data from youtube api but i keep getting an error. Here is the snippet where it choking: data = json.loads("""{ "entry":{ "etag":"W/\"A0UGRK47eCp7I9B9WiRrYU0.\...
Jagannath asked 6/2, 2012 at 6:34

2

Solved

I first saw it used in building regular expressions across multiple lines as a method argument to re.compile(), so I assumed that r stands for RegEx. For example: regex = re.compile( r'^[A...
Diglot asked 24/1, 2011 at 8:48

2

Solved

The latest draft of C++0x, n3126, says: Each instance of a backslash character (\) immediately followed by a new-line character is deleted, splicing physical source lines to form logical source li...
Flocky asked 27/12, 2010 at 17:27

2

Solved

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 comm...
Postconsonantal asked 19/8, 2010 at 0:24

4

Solved

In scala, "here docs" is begin and end in 3 " val str = """Hi,everyone""" But what if the string contains the """? How to output Hi,"""everyone?
Glyco asked 26/7, 2010 at 17:4

4

I need to do the following C# code in C++ (if possible). I have to initialize a long string with lots of quotes and other stuff in it. // C# verbatim string const String _literal = @"I c...
Sanmiguel asked 8/4, 2010 at 3:2

3

Solved

EDIT : This question doesn't really make sense once you have picked up what the "r" flag means. More details here. For people looking for a quick anwser, I added on below. If I enter a regexp manu...
Linseed asked 17/1, 2010 at 16:17

© 2022 - 2024 — McMap. All rights reserved.