2018年1月8日 星期一

Python: Print the documents of Python built-in function(s)

Python: Print the documents of Python built-in function(s)

Python Basic: Exercise-11 with Solution

Write a Python program to print the documents (syntax, description etc.) of Python built-in function(s).
Sample function: abs()
Python Docstring:
A docstring is a string literal that occurs as the first statement in a module, function, class, or method definition. Such a docstring becomes the __doc__ special attribute of that object.
All modules should normally have docstrings, and all functions and classes exported by a module should also have docstrings. Public methods (including the __init__ constructor) should also have docstrings.
Sample Solution:-
>>> print(abs.__doc__)
Return the absolute value of the argument.
>>> print(list.__doc__)
list() -> new empty list
list(iterable) -> new list initialized from iterable's items
>>> 


沒有留言:

張貼留言

第一次 作業 1219 ,RFID應用(四技日間部),國秀樓302教室, [選,3, 3], 四電三選7

 第一次  作業 1219 ,RFID應用(四技日間部),國秀樓302教室, [選,3, 3], 四電三選7  https://www.mediafire.com 超連結下載 https://www.mediafire.com/file/e297c5zkqaplo7z/RFID%...