简体   繁体   中英

How can I display a string with its rational expressions, such as '\'

I want to display a rational expression using Python 3. Because it is stored in my variable, it applies the effect of the backslash on my terminal, here is the rational expression I try to display:

struct = "{}\"{}\"{}{}{}"

So what I am trying to find is an expression that prints all the string, including the '\'

You can solve it like this:

struct = '{}\\"{}\\"{}{}{}'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM