导语:
本文主要介绍了关于如何给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的len函数?09/18
- ♥ python3是用什么写的12/16
- ♥ python的ide是什么?12/21
- ♥ python中的def是什么09/26
- ♥ python如何拆分列表11/01
- ♥ python支持哪些数据库09/12
内容反馈