control_characters.py

来自「python编程很好的入门材料,包括讲义和源码.」· Python 代码 · 共 41 行

PY
41
字号
#-------------------------------------------------------------------------------
# \n  (New line)
# A new line control character is like hitting Enter when you want to start a
# new line.
#-------------------------------------------------------------------------------

print "This goes on line one. \nThis goes on line two."

#-------------------------------------------------------------------------------
# \t  (Tab)
# Well, a tab is pretty much self explanatory.
#-------------------------------------------------------------------------------

print "This \tline \tis \tfull \tof \ttabs."

#-------------------------------------------------------------------------------
# \\  (Backslash)
# Since the backslash is used by control characters, you need to use a double
# backslash to represent an actual backslash.
#-------------------------------------------------------------------------------

print "C:\\Program Files\\Adobe\\Photoshop 7.0\\Plug-Ins"

#-------------------------------------------------------------------------------
#  \' (Single Quote)
# If our string uses double quotes, we must print out single quotes or the
# Python interpreter will get confused.
#-------------------------------------------------------------------------------

print "ERROR: Level Editor failed to load, 'Temple of Doom'!"

#-------------------------------------------------------------------------------
#  \"  (Double Quote)
# If our string uses single quotes, we must print out double quotes or the
# Python interpreter will get confused.
#-------------------------------------------------------------------------------

print 'ERROR: Level Editor failed to load, "Temple of Doom"!'

raw_input( "\nPress Enter to exit..." )

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?