Assigning a number that starts with 0

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • darktemp
    New Member
    • Feb 2010
    • 25

    Assigning a number that starts with 0

    Is there a way to assign a value of '000' to '099'?

    I have a file sorter program that has files with 000 in their filename and the best way to identify them is with the number. The numbers range from 000 to 999.
  • Glenton
    Recognized Expert Contributor
    • Nov 2008
    • 391

    #2
    I don't really understand your question. Perhaps you can let us know what you're trying to do.

    Taking a wild guess, maybe this interactive session will help you:
    Code:
    In [6]: for i in range(10):
        print "%03d" %i
       ...:     
       ...:     
    000
    001
    002
    003
    004
    005
    006
    007
    008
    009

    Comment

    • darktemp
      New Member
      • Feb 2010
      • 25

      #3
      I was sorting tiles of images from 000 to 999. Had to make the first 10 pictures in a row, then start a new row.

      Your snippet of code helped me accomplish this by outputting the value as a string which was enough to sort the images nicely.

      Thank you!

      Comment

      Working...