1.Python注释
单行注释:
python中单行注释采用 #开头
多行注释:
python中多行注释是在代码始末采用一对'''或者"""
单行/多行注释快捷键:
选择代码,使用ctrl+/
2.F12调试页面位置切换
F12位置切换(左侧,右侧,下方,新窗口)
3.
#-*-coding:utf-8-*-
#整型用%d,字符串用%s
name = "zhutaifei"
age = 25
print("Hello %s , Nice to meet you !" %name)
print("Your age is %d" %age)
print("%s is %d years old" %(name,age))
#如果不知道类型,可以使用%r
print("Hello %r , Nice to meet you !" %name)
print("Your age is %r" %age)
print("%r is %r years old" %(name,age))
print("你好,今天天气不错!")
print('你好,今天天气不错!')
print("你说:'今天天气不错!'")
print('你说:"今天天气不错!"')
#单行注释
'''
优美胜于丑陋
简单胜于复杂
间隔胜于紧凑
'''
"""
木欣欣以向荣
泉涓涓而始流
"""
a = 5
b = 6
if a>b:
print("a>b")
else:
print("a<=b")
student = "zhutaifei"
if student == "zhutaifei":
print("zhutaifei,you are on duty today!")
else:
print("zhutaifei,you are not on duty today!")
HK = "Hello world!"
if "hello" in HK:
print("contain")
else:
print("not contain")
注意:
python没有像其他大多数语言一样使用"{}"表示语句体,所以,它通过语句的缩进来判断语句体,缩进默认为4个空格
#coding=utf-8或者#-*-coding:utf-8-*-为了防止乱码问题,以及方便的在程序中添加中文注释,把编码统一成UTF-8.等号两边不要留空格,否则将不起作用