导语:
本文主要介绍了关于如何给python代码快速添加注释的相关知识,包括python代码的单行注释,以及python单行注释开头这些编程知识,希望对大家有参考作用。
python代码快速添加注释的方法
选中要注释的代码,按下ctrl+/注释。
实例
#----->1.用一对"""括起来要注释的代码:
"""
number = 23
guess = int(raw_input('Enter an integer : '))
if guess == number:
print 'Congratulations, you guessed it.' # New blockstarts here
print "(but you do not win any prizes!)" # New blockends here
elif guess < number:
"""
#----->2.用一对'''括起来要注释的代码块:
'''
print 'No, it is a little higher than that' #Another block
# You can do whatever you want in a block ...
else:
'''
#----->3.选中要注释的代码,按下ctrl+/注释:
# print 'No, it is a little lower than that'
# # you must have guess > number to reach here
# print 'Done'
# # This last statement is always executed, after the ifstatement is executed
本文为原创文章,版权归知行编程网所有,欢迎分享本文,转载请保留出处!
你可能也喜欢
- ♥ 为什么我劝你不要盲目追随Python?11/25
- ♥ Python中处理属性的重要属性和函数有哪些12/28
- ♥ python如何设置错误跳过?09/25
- ♥ 如何使用 python subprocess.popen?11/17
- ♥ python3.7打包成exe需要三步10/27
- ♥ 如何在python3中清除屏幕10/05
内容反馈