+ 1

What is thr meaning of '%' in string formatting??

https://code.sololearn.com/cwI6eeB470in/?ref=app In this code I get different output if I change %a with %s. Does it have any special meaning if yes what it is and what are the other such character.

12th Jul 2019, 5:15 PM
Akash
Akash - avatar
3 Respostas
+ 4
Using %s style formatters is the old way of string formatting. Please check this link that explains the various ways to do this in python. https://pyformat.info/ %a is supposed to refer to the ascii representation of the string.
13th Jul 2019, 8:47 AM
Tibor Santa
Tibor Santa - avatar
+ 3
% is the prefix that indicates that what follows is the type of what should be formatted to. %s means insert of a string %a is no valid format which i know (I also didn't find it in the tutorial linked below) http://python-reference.readthedocs.io/en/latest/docs/str/formatting.html Sry for my bad english.
12th Jul 2019, 6:47 PM
Checker 8763
Checker 8763 - avatar
+ 2
Checker 8763 thanks and your english is not bad, writing that again and again will make your brain think it is bad
13th Jul 2019, 5:20 PM
Akash
Akash - avatar