I need to use double quotes in a string that uses the @ symbol. Using double quotes is breaking the string. I tried escaping with \, but that doesn't work. Ideas?
Use a formatted string literal to add double quotes around a variable in Python, e.g. result = f'"{my_var}"' . Formatted string literals let us include variables inside of a string by prefixing the string with f .
How to Escape Quotes in a String. To add quoted strings inside of strings, you need to escape the quotation marks. This happens by placing a backslash ( \ ) before the escaped character. In this case, place it in front of any quotation mark you want to escape.
The use of quotation marks, also called inverted commas, is very slightly complicated by the fact that there are two types: single quotes (` ') and double quotes (" ").
I believe this should work:
string myString = @"Here is my ""quoted"" text.";
You double the quotes inside a verbatim string to get a quote character.
This makes your given sample:
(@"PREFIX rdfs: <" + rdfs + @">
SELECT ?s ?p ?o
WHERE { ?s ?p rdfs:Literal }
{?s rdfs:label ""date""}");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With