📄 type_conversion.py
字号:
#-------------------------------------------------------------------------------
# With out the explicit conversion, Python will automatically upgrade your
# addition to "floating-point" addition, which may not be what you want
# especially if your intention was to drop the decimal places.
#-------------------------------------------------------------------------------
myInt = 25
myFloat = 25.12
myString = "The value of 'myInt' is "
print myInt + myFloat
# With conversion - to int
print myInt + int( myFloat )
# With conversion - to string
print myString + str( myInt )
raw_input( "\nPress Enter to exit..." )
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -