Examples of the digital output string and python

Interestingly, however, in the javascript where we will of course be ideal string and digital connections, because it is a dynamic language thing but a bit strange in Python, as follows:

#! /usr/bin/python

a=2
b="test"
c=a+b


This line will run the program error, suggesting that you can not connect strings and numbers, so he had to convert with built-in functions

#! / Usr / bin / Python
# line running program error, suggesting that you can not connect strings and numbers, so he had a built-in function to convert
A = 2
B = "Test"
C = STR (A) B +
D = "1111"
E = A + int (D)
#How to Multiply values Print
Print ( "IS C% S,% I IS E"% (C, E))
'' '
knowledge:

    * str function and an int strings and numbers convert
    * Print begin with #, rather than the customary //
    way to print multiple parameters *
    '' '

Guess you like

Origin www.cnblogs.com/fanweisheng/p/11243835.html