Python foydali help() funksiyasini ham taqdim etadi. help() funksiyasi moduldagi hujjat satrlarini o'qiydi va ularni chiqaradi. Agar ishlab chiquvchi kodiga yaxshi hujjat qo'shgan bo'lsa, unda siz Python'ni foydalanib, u haqida ma'lumot olishingiz mumkin.
Keling, code modulida bu funksiyani sinab ko'raylik:
>>> help(code)Help on module code:NAME code - Utilities needed to emulate Python's interactive interpreter.MODULE REFERENCE https://docs.python.org/3.8/library/codeThe following documentation is automatically generated from the Pythonsource files. It may be incomplete, incorrect or include features thatare considered implementation detail and may vary between Pythonimplementations. When in doubt, consult the module reference at thelocation listed above.CLASSES builtins.object InteractiveInterpreter InteractiveConsoleclass InteractiveConsole(InteractiveInterpreter) | InteractiveConsole(locals=None, filename='<console>') | | Closely emulate the behavior of the interactive Python interpreter.
Bu misol help(code) chaqirganda oladigan birinchi yordam sahifasini ko'rsatadi. Hujjatlarni o'qish uchun bo'sh joy tugmasini bosishingiz yoki bir vaqtning o'zida bir qatorni o'tkazish uchun Enter tugmasini bosishingiz mumkin. Agar yordamdan chiqmoqchi bo'lsangiz, q tugmasini bosing.
Keling, interact() funksiyasi haqida yordam olishga harakat qilaylik:
>>> help(code.interact)Help on function interact in module code:interact(banner=None, readfunc=None, local=None, exitmsg=None) Closely emulate the interactive Python interpreter. This is a backwards compatible interface to the InteractiveConsole class. When readfunc is not specified, it attempts to import the readline module to enable GNU readline if it is available.Arguments (all optional, all default to None): banner -- passed to InteractiveConsole.interact() readfunc -- if not None, replaces InteractiveConsole.raw_input() local -- passed to InteractiveInterpreter.__init__() exitmsg -- passed to InteractiveConsole.interact()
Siz dir() funksiyasidan tanish bo'lmagan moduldagi metodlar va atributlar haqida ma'lumot olish uchun foydalanishingiz mumkin. Keyin esa help() funksiyasidan foydalanib, modul yoki uning har qanday komponenti haqida qo'shimcha ma'lumot olishingiz mumkin.