Meaning of% in strings!

0

Hello, I was following a video lesson in Python string formatting and I saw that the teacher used% d and%, but my internet is having problems loading the video, I wanted to know what that means%     

asked by anonymous 17.01.2018 / 21:00

1 answer

1

As stated,% is for formatting.

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

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

The second% effectively performs the substitution by the right values.

    
17.01.2018 / 21:20