April 3rd, 2003, 05:02 PM
How do you combine strings and ints?
How do you combine a string and an int in Python? For example, I was messing around with some of the winsound functions, and when I tried something like:
print "Bitrate: " + params
Params being the second element in the params array, which is contains information about the sound file (ie. type, bitrate, mono/stereo, etc.). I got an error saying I couldn't combine a string with an int (which, by the way is the stupidest syntax rule I've ever heard).
April 3rd, 2003, 06:11 PM
Re: How do you combine strings and ints?
Either will work.
print "Bitrate: %d" % params
print "Bitrate: " + str(params)
Have you gone through the tutorial on www.python.org ?
April 3rd, 2003, 07:31 PM
Converting the int to a string....duh! Why didn't I think of that?