Generally, if you are on Windows and you have installed the Pycharm integrated development environment, there is no such problem (Ctrl + mouse click on the object name, you can directly view the usage of specific functions). Take the third-party module prettytable as an example:
import prettytable as pt
# 按行添加数据
tb = pt.PrettyTable()
tb.field_names = ["id", "name", "phone", "age", "sex", "description"]
tb.add_row([1, "zhangsan", "132****2889", 25.23, "M", "NoDesc"])
tb.add_row([3, "lisi", "152****7873", 18, "F", "None"])
tb.add_row([5, "wangwu", "136****2908", 25, "M", "Nothing"])
tb.add_row([10,"zhaoliu", "138****5322", 15, "M", "Nothing"])
print(tb)
# 按列添加数据
create_time = ["2020-11-30 20:03:07", "2020-11-30 20:08:33", "2020-11-30 20:10:11", "2020-11-30 20:12:11"]
tb.add_column("create_time", create_time)
print(tb)
------------------------------------------------------------
# prettytable.py
...
class PrettyTable(object):
def __init__(self, field_names=None, **kwargs):
"""Return a new PrettyTable instance
Arguments:
encoding - Unicode encoding scheme used to decode any encoded input
field_names - list or tuple of field names
fields - list or tuple of field names to include in displays
start - index of first data row to include in output
end - index of last data row to include in output PLUS ONE (list slice style)
header - print a header showing field names (True or False)
...
You can also intelligently remind the module which functions can be called and the parameters that can be set:
What if it is on the command line? Is there a way to check it? (Of course there are! Don’t forget the role of help)
[root@master ~]# python3
Python 3.6.8 (default, Aug 7 2019, 17:28:10)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-39)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> help('prettytable')
Help on package prettytable:
NAME
prettytable
PACKAGE CONTENTS
prettytable
CLASSES
builtins.object
prettytable.prettytable.PrettyTable
html.parser.HTMLParser(_markupbase.ParserBase)
prettytable.prettytable.TableHandler
class PrettyTable(builtins.object)
| Methods defined here:
|
| __getattr__(self, name)
|
| __getitem__(self, index)
|
| __init__(self, field_names=None, **kwargs)
| Return a new PrettyTable instance
|
...
| add_row(self, row)
| Add a row to the table
|
| Arguments:
|
| row - row of data, should be a list with as many elements as the table
| has fields
|
| add_rows(self, rows)
| Add rows to the table
|
| Arguments:
|
| rows - rows of data, should be an iterable of lists, each list with as many
| elements as the table has fields
|
| clear(self)
| Delete all rows and field names from the table, maintaining nothing but
| styling options
|
| clear_rows(self)
| Delete all rows from the table but keep the current field names
|
...