%s %x %0.2f %04d

Brendhan Horne brendhan at bellsouth.net
Fri Sep 8 17:14:32 EDT 2000


In the beginners instruction manual it states:
There are other letters that can be placed after the % markers. Some of
those include:
%s- for string
%x- for hexadecimal number
%0.2f- for a real number with a maximum of 2 decimal places
%04d- pad the number out to 4 digits with 0's


That is nice but it gives no examples of how to use them. I tried some of
the basics
>>> print 7%s2
Got an error
>>> print 7 %s 2
Got an error
So if someone could show me some basic one liners that use the modulus with
the suffix I would appreciate it.  Remember when you do this you are dealing
with someone who has no knowledge of computer language.


--
Thanks,
Brendhan






More information about the Python-list mailing list