Multi-line Comments in Python / Python中的多行注释

Python注释技巧
本文探讨了Python中的注释方法,特别是在Python中缺乏多行注释语法的情况下如何有效地使用单行注释及字符串来达到注释的目的。作者还讨论了将不需要的代码段用三引号括起来的方法,尽管这种方法实际上被解释为字符串而非注释。

So interesting is python...

I'm gonna record down what I find in python while I'm learning it.

 

The first one is...... the comment

When I was trying to "comment" some lines of code, I found there was only line comments in python. There isn't syntax of multi-line comment like "/*..*/" in C, in Python.

Then I came up with an idea, there did exist a method to make some lines "invalid" which is to put them into quotes. Just like this:

"""

print 'THIS IS WHAT I DONT NEED CURRENTLY"

"""

In fact this is not any kind of  "comment". It would be intepreted as a string and have an negative affect upon effeciency. As python is slow indeed, certainly the case can be ignored:)

 
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值