![]() |
VOOZH | about |
In Python, a string of required formatting can be achieved by different methods. Some of them are; 1) Using % 2) Using {} 3) Using Template Strings In this article the formatting using % is discussed. The formatting using % is similar to that of 'printf' in C programming language. %d - integer %f - float %s - string %x - hexadecimal %o - octal The below example describes the use of formatting using % in Python.
Variable as string = 15 Variable as raw data = '15' Variable as integer = 15 Variable as float = 15.000000 Variable as printing with special char = m Variable as hexadecimal = f Variable as octal = 17...