Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Python     wzyang@kkbox.com
• docstring• pydoc• ipython• doctest• sphinx
docstring
docstring•         Class        Method                   Class    Method•              Class    Method    __doc__
class MyClass():	 def plus(self, x):	 	 return x + 1mc = MyClass()y = mc.plus(1)
This is a moduleclass MyClass():	 This is my Class		 def plus(self, x):	 	 The method pluses one.	 	 return x + 1mc = MyCl...
This is a moduleclass MyClass():	 def plus(self, x):	 	 return x + 1import sysprint sys.modules[__name__].__doc__
pydoc
$pydoc MyClass
$pydoc -p 8080
ipython.A better interactive mode.   $easy_install ipython
doctest
class MyClass():	 def plus(self, x):	 	 	 	 The method pluses one.	   	   >>> mc = MyClass()	   	   >>> mc.plus(1)	   	   ...
Sphinx$easy_install sphinx
$sphinx-quickstart
:mod:`MyClass` Module+++++++++++++++++++++This is my class..... autoclass:: MyClass.MyClass	 :members:
$make html
Python 的文件系統
Python 的文件系統
Python 的文件系統
Python 的文件系統
Python 的文件系統
Python 的文件系統
Python 的文件系統
Upcoming SlideShare
Loading in …5
×

Python 的文件系統

809 views

Published on

Published in: Technology
  • Be the first to comment

Python 的文件系統

  1. 1. Python wzyang@kkbox.com
  2. 2. • docstring• pydoc• ipython• doctest• sphinx
  3. 3. docstring
  4. 4. docstring• Class Method Class Method• Class Method __doc__
  5. 5. class MyClass(): def plus(self, x): return x + 1mc = MyClass()y = mc.plus(1)
  6. 6. This is a moduleclass MyClass(): This is my Class def plus(self, x): The method pluses one. return x + 1mc = MyClass()print mc.__doc__print mc.plus.__doc__
  7. 7. This is a moduleclass MyClass(): def plus(self, x): return x + 1import sysprint sys.modules[__name__].__doc__
  8. 8. pydoc
  9. 9. $pydoc MyClass
  10. 10. $pydoc -p 8080
  11. 11. ipython.A better interactive mode. $easy_install ipython
  12. 12. doctest
  13. 13. class MyClass(): def plus(self, x): The method pluses one. >>> mc = MyClass() >>> mc.plus(1) 2 return x + 1if __name__ == __main__: import doctest doctest.testmod()
  14. 14. Sphinx$easy_install sphinx
  15. 15. $sphinx-quickstart
  16. 16. :mod:`MyClass` Module+++++++++++++++++++++This is my class..... autoclass:: MyClass.MyClass :members:
  17. 17. $make html

×