python开发常用快捷键

一 :pycharm多行代码同时注释、去除注释

代码选中的条件下,同时按住 Ctrl+/,被选中行被注释,再次按下Ctrl+/,注释被取消

二:help和dir的用法

当你给dir()提供一个模块名字时,它返回在那个模块中定义的名字的列表。当没有为其提供参数时, 它返回当前模块中定义的名字的列表。
dir() 函数使用举例:

1
2
3
4
5
6
>>>  import  sys   # 获得属性列表,在这里是sys模块的属性列表
>>>  dir (sys)
[ '__displayhook__' '__doc__' '__excepthook__' '__name__'
'__package__' '__stderr__' '__stdin__' '__stdout__'
'_clear_type_cache' '_compact_freelists' , '_current_frames'
'_getframe' 'api_version' 'argv' , ...]

如果您需要快速获取任何的Python函数或语句的信息,那么您可以使用内置的“help”(帮助)功能。这是非常有用的,尤其是当使用翻译提示符时,例如,运行‘help(print)”——这将显示print函数的帮助--用于打印东西到屏幕上。

help()函数使用举例:

1
2
3
4
5
6
>>> help(print)
Help on built- in  function  print  in  module builtins:
 
print(...)
     print(value, ..., sep= ' ' , end= '\n' file =sys.stdout, flush=False)
...

猜你喜欢

转载自blog.csdn.net/songruibb/article/details/80856634