Meaning of %in strings!

Asked

Viewed 691 times

0

Hi, I was following a video formatting lessons of strings in Python and I saw that the teacher used %d and %, but my internet is having problems to load the video, I wanted to know what that means %

  • If I’m not mistaken, it’s for formatting. The %d is formatted and replaced by something when the string is called.

1 answer

1


As stated, the % is for formatting.

>>> "Uso do percent %d" % 30

The first %d mark that at this point there is a place (placeholder) to replace by a decimal (to be informed in the future).

The second % effectively replaces the values to the right.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.