python中如何快捷添加注释

图片[1]-python中如何快捷添加注释-uusu优素-乐高,模型,3d打印,编程

本人使用的编辑器是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
喜欢就支持一下吧
点赞7 分享
评论 抢沙发
头像
欢迎您留下宝贵的见解!
提交
头像

昵称

取消
昵称表情代码图片

    暂无评论内容