简体   繁体   English

如何阅读某个模块的文档?

[英]How to read the documentation of a certain module?

I've just finished my course of Python, so now I can write my own script.我刚刚完成了我的 Python 课程,所以现在我可以编写自己的脚本了。 So to do that I started to write a script with the module Scapy, but the problem is, the documentation of Scapy is used for the interpreter Scapy, so I don't know how to use it, find the functions, etc.为此,我开始用模块Scapy编写脚本,但问题是,Scapy的文档是用于解释器Scapy的,所以我不知道如何使用它,找不到函数等。

I've found a few tutorials in Internet with a few examples but it's pretty hard.我在互联网上找到了一些教程和一些例子,但这很难。 For example, I've found in a script the function "set_payload" to inject some code in the layer but I really don't know where he found this function.例如,我在一个脚本中找到了函数“set_payload”来在层中注入一些代码,但我真的不知道他在哪里找到了这个函数。

What's your suggestion for finding how a module works and how to write correctly with it?您对查找模块如何工作以及如何正确编写模块有什么建议? Because I don't really like to check and pick through other scripts on Internet.因为我真的不喜欢在互联网上检查和挑选其他脚本。

I've never used Scapy but it seems well documented.我从未使用过 Scapy,但它似乎有据可查。

https://buildmedia.readthedocs.org/media/pdf/scapy/latest/scapy.pdf https://buildmedia.readthedocs.org/media/pdf/scapy/latest/scapy.pdf

This version appearing to have been released at the time of writing this.此版本似乎在撰写本文时已发布。

If I have understood the question correctly, roughly what you are asking is how to find the best source to understand a module.如果我正确理解了这个问题,那么您大致问的是如何找到理解模块的最佳来源。

If you are using an inbuilt python module, the best source is the python documentation.如果您使用的是内置的 Python 模块,最好的来源是 Python 文档。 Scapy is not a built-in python module. Scapy 不是内置的 Python 模块。 So you may have some issues with some of the external modules (by external I mean the ones you need to explicitly install).因此,您可能会遇到一些外部模块的问题(外部模块是指您需要明确安装的模块)。

For those, if the docs aren't enough, I prefer to look at some of the github projects that may use that module one way or the other and most of the times it works out.对于那些,如果文档还不够,我更喜欢查看一些 github 项目,这些项目可能以一种或另一种方式使用该模块,并且大多数情况下它都有效。 If it doesn't, then I go to some blogs or some third party tutorials.如果没有,那么我会去一些博客或一些第三方教程。 There is no right way to do it, You will have to put in the effort where its needed.没有正确的方法可以做到这一点,您必须在需要的地方付出努力。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM