[Tutor] Unable to take input as a module
Ewald Ertl
ewald.ertl at hartter.com
Wed Feb 22 16:40:31 CET 2006
Hello rakesh,
Perhaps this could take you further:
[GCC 3.3.2] on sunos5
Type "help", "copyright", "credits" or "license" for more information.
>>> a=__import__("inspect")
>>> a
<module 'inspect' from 'inspect.pyc'>
>>> a.ismodule(a)
True
HTH Ewald
Rakesh Mishra wrote:
> hi
>
> I am trying to write a program, which ask for user input for a name
> then determines it wither that is module or not, if module then it will
> tell all its
> attributes, methods, function etc
>
> my code:
> ..........
> .
> import sys, types, string, inspect
>
> input= sys.argv[1]
> print inspect.ismodule(input)
> ................
>
> here it always give false. as what ever input i take it is string .
>
> my problem is i am not able to take input as a module
> help me out !
> thanks in advance.
> rakesh
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Tutor maillist - Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
--
Ing. Ewald Ertl HartterGruppe Phone : +43-3352-33085-558
trinomic Projektmanagement & Informationstechnik GmbH Fax : +43-3352-33085-600
Wiener Straße 41 mailto:ewald.ertl at trinomic.com
A-7400 Oberwart http://www.trinomic.com mailto:ewald.ertl at hartter.com
More information about the Tutor
mailing list