1. NodeBox 1
    1. Homepage
    2. NodeBox 3Node-based app for generative design and data visualization
    3. NodeBox OpenGLHardware-accelerated cross-platform graphics library
    4. NodeBox 1Generate 2D visuals using Python code (Mac OS X only)
  2. Gallery
  3. Documentation
  4. Forum
  5. Blog

Int to String

Posted by newbee on Nov 26, 2007

Is there any code to change an integer (0r number) into a string.
I need this for the following example;

iCounter = 2257 
 
# here i would like to place a code that changes the iCounter Int into a string.
 
for i in range(100):
    image("IMG_"+ iCounter +".jpg", 0, 0)
    iCounter += 1


 
Posted by Tom De Smedt on Nov 26, 2007

Certainly, just use the str() command:

image("IMG_"+ str(iCounter) +".jpg", 0, 0)



Posted by anonymous on Nov 26, 2007

This also works:image("IMG_%s.jpg"%iCounter, 0, 0)See here for more on string formatting.



Posted by anonymous on Nov 26, 2007

Oops, that didn't work, let me try again:
This also works:

image("IMG_%s.jpg"%iCounter, 0, 0)
See here for more on string formatting.