How to create ones own lib

Nick Craig-Wood nick at craig-wood.com
Wed Aug 19 06:29:53 EDT 2009


Horst Jäger <h.jaeger at medienkonzepte.de> wrote:
>  I would like to create my own lib "hotte.py" which I can import like
> 
>  	import string,hotte
> 
>  . How do I do that?

One of the nice things about python is that you don't need to do
anything special to define a library.

Just define your classes / functions in hotte.py

then use them like

  import hotte

  hotte.MyClass()
  hotte.my_function()

See here for the relevant bit of the tutorial

  http://docs.python.org/tutorial/modules.html

-- 
Nick Craig-Wood <nick at craig-wood.com> -- http://www.craig-wood.com/nick



More information about the Python-list mailing list