[Tutor] Unable to take input as a module
Karl Pflästerer
khp at pflaesterer.de
Wed Feb 22 13:06:13 CET 2006
On 22 Feb 2006, rakesh.mishra at gmail.com wrote:
> 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 !
Go the other way. Every module has an atribute called `__name__'. And
this is a string. So compare the user input with e.g `sys.__name__'
(which is 'sys').
Karl
--
Please do *not* send copies of replies to me.
I read the list
More information about the Tutor
mailing list