[Python] 3 Ways of Formatted String
There are 3 ways to write a formatted string in Python3. Let's check it one by one. Formatted String with Placeholder This method seems like a C language. It uses string-formatting operator %. print("String: %c, %s" % ('h', 'python')) # String: hello, python print("Integer: %d, %i" % (3, 7)) # Integer: 3, 7 print("Floating: %f, %F, %3.2f" % (2.818, 1.414, 3.14159)) # Floating: 2.818000, 1.414000..
2021. 1. 22.