-1

I have following lines

{value!r}".format(value=value) 
%(access_token)r % value

What does r and ! mean here?

1
  • 1
    That doesn't look like a legit (minimal) snippet. Commented Apr 30, 2016 at 23:27

2 Answers 2

1

It's a conversion operation. It converts value to a string using repr()

Check out "Explicit Conversion Flag" in https://www.python.org/dev/peps/pep-3101/ for more info.

Sign up to request clarification or add additional context in comments.

2 Comments

what diffrence between str() and repr()?
Here's a description of the two. stackoverflow.com/questions/19331404/…
0

r means print the repr() of the object. ! is what allows it to work in format strings.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.