Syntax error - what's wrong?

Gordon McMillan gmcm at hypernet.com
Sun Oct 17 22:27:30 EDT 1999


Um, Jeff, that _is_ string.py, exactly as in my lib. Note that the 
traceback, however, is missing the trailing "s" on line 480. 
Strange.

Andre-John: You appear to have a bad RPM somehow. 
Python is a cinch to build on RedHat. I'd say go ahead and 
build it yourself.

> Andre-John Mas wrote:
> >  I have never programmed in Python before and need a quick
> >  crash course. I am installing Redhat Linux 6.1 and I am
> >  getting a Python related error.
> 
> Andre-John,
> 
> Your code worked when I pasted into to my editor
> and ran under Solaris 2.6, Python 1.5.2.
> 
> Here is a slightly different version which should
> accomplish the same goals:
> 
> def zfill(x, width):
>     fmt = "%%0%dd" % width
>     return fmt % int(x)
> 
> # optional test routine ...
> if __name__ == '__main__':
>     for x, width in [(12, 3), (-3, 3), (1, 6), ('17', 4)]:
>         print "zfill(%s, %d) = %s" % \
>               (x, width, zfill(x, width))
> 
> I tend to prefer downloading Python source and
> compiling it, rather than rely on the Linux
> distributions -- they always seem to leave out 
> my favorite features. ;-)
> 
> Regards,
> 
> Jeff Bauer
> Rubicon Research
> 
> -- 
> http://www.python.org/mailman/listinfo/python-list



- Gordon




More information about the Python-list mailing list