integer to string?
bignose-hates-spam at and-zip-does-too.com.au
Tue Jun 3 05:02:24 CEST 2003
On Tue, 03 Jun 2003 02:15:27 GMT, Hendrik Reinhold wrote:
> import random
> from random import randrange
> var1 = randrange(0,9)
As you noted, the types conflict. The type of an object is set when it
The Pythonic way to generate a string from multiple values of different
types is with string formatting:
rand_num = random.randrange( 0, 9 )
audio_file = "%s/%d.la" % my_path, rand_num
capisuite.audio_send( call, audio_file )
The '%' is the format operator for strings.
It returns a new string resulting from interpolating the right-hand-side
values into the left-hand-side format string.
\ "I used to work in a fire hydrant factory. You couldn't park |
`\ anywhere near the place." -- Steven Wright |
http://bignose.squidly.org/ 9CFE12B0 791A4267 887F520C B7AC2E51 BD41714B
More information about the Python-list