一次评论超过1行? [英] comment out more than 1 line at once?

查看:83
本文介绍了一次评论超过1行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的,


有没有一种方法可以在Python中注释出代码块而不需要在每行前面添加

#?某些事情如C'的


/ *

这里的代码块被注释掉了

* /


谢谢,


Riko

Dear all,

is there a way in Python to comment out blocks of code without putting a
# in front of each line? Somethings like C''s

/*
block of code here is commented out
*/

Thanks,

Riko

推荐答案

Riko Wichmann写道:
Riko Wichmann wrote:
亲爱的,

是否有一种方法可以在Python中注释出代码块而不需要在每行前面添加#?像C'的

/ *
代码块这样的东西被注释掉了
* /
Dear all,

is there a way in Python to comment out blocks of code without putting
a # in front of each line? Somethings like C''s

/*
block of code here is commented out
*/




否你为什么要这个?任何优秀的程序员编辑都会有一个

注释/取消注释功能,以便使用哈希字符('一次)轻松注释掉整个

代码块。 '#'')。


Aaron



No. Why do you want this? Any good programmer''s editor will have a
comment/uncomment feature to make it easy to comment out whole blocks of
code at a time using the hash character (''#'').

Aaron


我正在使用emacs(使用python-mode)做我的大部分编辑。还试过了来自python的
IDLE,这很不错但是老狗不喜欢

学习新技巧:)


也许我只是不知道用编辑器

命令来评论整个块。 Marc在下面的文章中提到的技巧可能就是这个工作。


我用它来测试通常从
另一个。为了测试不同的部分,我通常在文件中有不同的__main__

部分....


干杯,


Riko


Aaron Bingham写道:
I''m using emacs (with python-mode) to do most of my editing. also tried
IDLE from python already, which is nice but an old dog doesn''t like to
learn new tricks :)

Maybe I just don''t know to comment out whole blocks using editor
commands. Probably the trick Marc mentions in the following post will do
the job.

I use it to test pieces of a modules which usually is imported from
another. For testing different parts, I usually have different __main__
sections in the file ....

Cheers,

Riko

Aaron Bingham wrote:
Riko Wichmann写道:
Riko Wichmann wrote:
亲爱的,

是否有一种方法可以在Python中注释掉代码块而不需要在每行前面添加#?像C'的

/ *
代码块这样的东西被注释掉了
* /
Dear all,

is there a way in Python to comment out blocks of code without putting
a # in front of each line? Somethings like C''s

/*
block of code here is commented out
*/



号码为什么你想要这个吗?任何优秀程序员的编辑器都会有一个
注释/取消注释功能,以便使用哈希字符(''''')一次评论整个代码块。

Aaron


No. Why do you want this? Any good programmer''s editor will have a
comment/uncomment feature to make it easy to comment out whole blocks of
code at a time using the hash character (''#'').

Aaron



Riko Wichmann< ri *********** @ remove-this.desy.de> ;写道:
Riko Wichmann <ri***********@remove-this.desy.de> writes:
我正在使用emacs(使用python-mode)来完成我的大部分编辑工作。
[...]也许我只是不知道用编辑器
命令注释整个块。
I''m using emacs (with python-mode) to do most of my editing. [...] Maybe I just don''t know to comment out whole blocks using editor
commands.




comment-dwim(通常绑定到M-;)注释该区域是否有活动,或者,如果该区域已被评论,则取消注释。


Bernhard


-

Intevation GmbH http://intevation.de/

Skencil http:// skencil.org/

Thuban http:// thuban。 intevation.org/



comment-dwim (usually bound to M-; ) comments out the region if it''s
active, or, if the region is already commented, uncomments it.

Bernhard

--
Intevation GmbH http://intevation.de/
Skencil http://skencil.org/
Thuban http://thuban.intevation.org/


这篇关于一次评论超过1行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆