On Oct 29, 11:59 am, Tracubik <affdfsdfds...@b.com> wrote: > i've to convert integer x to string, but if x < 10, > the string have to be '0x' instead of simple 'x' > > for example: > > x = 9 > str(x) --> '09'
Everyone else seems to prefer the format-based solutions, which is fine. I will give zfill a little exposure, as it seems unloved/ underused: str(x).zfill(2) John -- http://mail.python.org/mailman/listinfo/python-list