Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #71854
| Date | 2014-05-21 23:46 +1000 |
|---|---|
| Subject | All-numeric script names and import |
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.10190.1400680014.18130.python-list@python.org> (permalink) |
If I have a file called 1.py, is there a way to import it? Obviously I
can't import it as itself, but in theory, it should be possible to
import something from it. I can manage it with __import__ (this is
Python 2.7 I'm working on, at least for the moment), but not with the
statement form.
# from 1 import app as application # Doesn't work with a numeric name
application = __import__("1").app
Is there a way to tell Python that, syntactically, this thing that
looks like a number is really a name? Or am I just being dumb?
(Don't hold back on that last question. "Yes" is a perfectly
acceptable answer. But please explain which of the several
possibilities is the way I'm being dumb. Thanks!)
ChrisA
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
All-numeric script names and import Chris Angelico <rosuav@gmail.com> - 2014-05-21 23:46 +1000
Re: All-numeric script names and import Mark H Harris <harrismh777@gmail.com> - 2014-05-21 09:24 -0500
Re: All-numeric script names and import Chris Angelico <rosuav@gmail.com> - 2014-05-22 00:40 +1000
Re: All-numeric script names and import Mark H Harris <harrismh777@gmail.com> - 2014-05-21 09:24 -0500
Re: All-numeric script names and import Rustom Mody <rustompmody@gmail.com> - 2014-05-22 19:08 -0700
Re: All-numeric script names and import Chris Angelico <rosuav@gmail.com> - 2014-05-23 13:26 +1000
Re: All-numeric script names and import Wolfgang Maier <wolfgang.maier@biologie.uni-freiburg.de> - 2014-05-23 10:58 +0200
Re: All-numeric script names and import Chris Angelico <rosuav@gmail.com> - 2014-05-23 19:02 +1000
Re: All-numeric script names and import Wolfgang Maier <wolfgang.maier@biologie.uni-freiburg.de> - 2014-05-23 11:22 +0200
Re: All-numeric script names and import Chris Angelico <rosuav@gmail.com> - 2014-05-23 19:28 +1000
Re: All-numeric script names and import Michael Torrie <torriem@gmail.com> - 2014-05-23 16:52 -0600
csiph-web