![图片[1]-python中如何快捷添加注释-uusu优素-乐高,模型,3d打印,编程](http://uusucn.zbbe.cn/wp-content/uploads/2024/01/5e73566b98911586.jpg)
本人使用的编辑器是pycharm,有三种注释方式:
1、用 一对""" 括起来要注释的代码块。
2、用一对'''括起来要注释的代码块。
3、选中要注释的代码,按下ctrl+/注释。
实例
#!/usr/bin/python
#coding=gbk
#Filename:if.py
#----->1.用一对"""括起来要注释的代码:
"""
number=23
guess=int(raw_input('Enteraninteger:'))
ifguess==number:
print'Congratulations,youguessedit.'#Newblockstartshere
print"(butyoudonotwinanyprizes!)"#Newblockendshere
elifguess<number:
"""
#----->2.用一对'''括起来要注释的代码块:
'''
print'No,itisalittlehigherthanthat'#Anotherblock
#Youcandowhateveryouwantinablock...
else:
'''
#----->3.选中要注释的代码,按下ctrl+/注释:
#print'No,itisalittlelowerthanthat'
##youmusthaveguess>numbertoreachhere
#print'Done'
##Thislaststatementisalwaysexecuted,aftertheifstatementisexecuted原文来自:https://www.py.cn © 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END



















































暂无评论内容