|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
||||
|
||||
|
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[1] Params[1] 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).
__________________
Matt |
|
#2
|
|||
|
|||
|
Re: How do you combine strings and ints?
Quote:
Code:
print "Bitrate: %d" % params[1] print "Bitrate: " + str(params[1]) Either will work. Have you gone through the tutorial on www.python.org ? |
|
#3
|
||||
|
||||
|
Quote:
Converting the int to a string....duh! Why didn't I think of that? Thanks! |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Python Programming > How do you combine strings and ints? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|