Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #94963
| Date | 2015-08-04 20:35 +0800 |
|---|---|
| Subject | Re: How to import a function from another module... |
| From | Dwight GoldWinde <Dwight@GoldWinde.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.1212.1438693831.3674.python-list@python.org> (permalink) |
[Multipart message — attachments visible in raw view] - view raw
> Thank you, Steven. > I am a newbie with Python? so I really want to learn how to do it the easy > way. > Yes, could you tell me how to put the py.file that contains the function > in the Python search path??? > BIG SMILE... > Always, Dwight > www.3forliving.key.to (video playlist on YouTube) > www.couragebooks.key.to (all my books on Amazon) > On 8/4/15, 9:24 AM, "Steven D'Aprano" <steve@pearwood.info> wrote: >> >On Tue, 4 Aug 2015 09:57 am, Dwight GoldWinde wrote: >> > >>> >> I am trying to import a function defined in another module. >> > >> >You can't use spaces in the name of importable Python modules: change the >> >name from "Simulate typing.py" to "simulate_python.py". You can use spaces >> >in file names if they are only used as a runnable script and not imported. >> > >> >Then use this: >> > >> >from simulate_python import humprint >> > >> >There's no need to use importlib. >> > >> >You may need to arrange for the simulate_python file to be placed >> >somewhere >> >in the Python search path. Do you need help with that? >> > >> >What you are trying to do with importlib is fight the language. Your life >> >will be much simpler if you work within the parameters of how the language >> >is designed to work. >> > >> > >> > >> >-- >> >Steven >> > >> >-- >> >https://mail.python.org/mailman/listinfo/python-list >
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
Re: How to import a function from another module... Dwight GoldWinde <Dwight@GoldWinde.com> - 2015-08-04 20:35 +0800 Re: How to import a function from another module... marco.nawijn@colosso.nl - 2015-08-04 08:04 -0700
csiph-web