- 论坛徽章:
- 145
|
回复 1# 274920831
would you like the getattr function
>>> dir(difflib)
['Differ', 'HtmlDiff', 'IS_CHARACTER_JUNK', 'IS_LINE_JUNK', 'Match', 'SequenceMatcher', '__all__', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__', '_calculate_ratio', '_check_types', '_count_leading', '_file_template', '_format_range_context', '_format_range_unified', '_legend', '_mdiff', '_namedtuple', '_nlargest', '_styles', '_table_template', '_test', 'context_diff', 'diff_bytes', 'get_close_matches', 'ndiff', 'restore', 'unified_diff']
>>> for x in dir(difflib):
... print(x, getattr(difflib,x))
...
Differ <class 'difflib.Differ'>
HtmlDiff <class 'difflib.HtmlDiff'>
IS_CHARACTER_JUNK <function IS_CHARACTER_JUNK at 0x7fb58f685048>
IS_LINE_JUNK <function IS_LINE_JUNK at 0x7fb58f682b70>
Match <class 'difflib.Match'>
...
ndiff <function ndiff at 0x7fb58efa8ae8>
restore <function restore at 0x7fb58efa8bf8>
unified_diff <function unified_diff at 0x7fb58efa8840>
|
|