When you provide a module name to Dir (), it returns a list of the names defined in that module. When no arguments are provided for it, it returns a list of the names defined in the current module.
The Dir () function uses an example:
| 123456 |
>>> importsys # 获得属性列表,在这里是sys模块的属性列表>>> dir(sys)[‘__displayhook__‘, ‘__doc__‘, ‘__excepthook__‘, ‘__name__‘, ‘__package__‘, ‘__stderr__‘, ‘__stdin__‘, ‘__stdout__‘, ‘_clear_type_cache‘, ‘_compact_freelists‘,‘_current_frames‘, ‘_getframe‘, ‘api_version‘, ‘argv‘, ...] |
If you need to quickly get information about any of the Python functions or statements, you can use the built-in Help feature. This is very useful, especially when using the translation prompt, for example, running ' help print '--this will show the print function--for printing things to the screen.
The Help () function uses an example:
| 1 23456 |
>>> help (print) help on built- in function print in module builtins: print (...)      print (value, ..., sep= ' ' , end= ' \ n ' , file =sys.stdout, flush=false) Code class= "Bash plain" > ... |
Dir, help, str usage for Python