[EMAIL PROTECTED] schreef: > Hi, > > String formatting can be used to converting an integer to its octal or > hexadecimal form: >>>> a = 199 >>>> "%o" % a > '307' >>>> "%x" % a > 'c7' > > But, can string formatting be used to convert an integer to its binary > form ? > > > Thanks in advance. > > xiaojf
I don't actually know how to do it with string formatting but you can create a simple function to do it. Here's an example: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/219300 Regards, Benedict -- http://mail.python.org/mailman/listinfo/python-list