+ 3

Is this a dictionary? (Python)

Hi everyone, I'm a new learner and I have a question. I saw a code like this: s=["%s\n" % x], where x is a string variable. What is the term for s here? Is it a dictionary? But it doesn't have a key and a value.

28th Dec 2019, 11:06 AM
laurel
2 Respuestas
+ 7
What you see there is a format specifier. It's a pattern that looks a bit like C. You use it when you want to 'insert' a value into a string. % is the point where the value is to be inserted, s means string. Read more here: https://www.learnpython.org/en/String_Formatting
28th Dec 2019, 11:47 AM
HonFu
HonFu - avatar
0
Akun Saya diretas diganti password sorry saya uninstall dulu
29th Dec 2019, 1:01 AM
Agung Sutrisna
Agung Sutrisna - avatar
0
Akun Saya diretas diganti password sorry saya uninstall dulu
29th Dec 2019, 1:02 AM
Agung Sutrisna
Agung Sutrisna - avatar