Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #45516
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!news2.arglkargh.de!news.mixmin.net!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.006 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'example:': 0.03; 'subject:file': 0.07; 'exec': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'python': 0.11; 'doc:': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'subject:run': 0.16; 'wrote:': 0.18; 'header:User-Agent:1': 0.23; 'specify': 0.24; 'header:X-Complaints-To:1': 0.27; 'header:In- Reply-To:1': 0.27; 'am,': 0.29; 'kevin': 0.30; 'url:python': 0.33; 'except': 0.35; 'more,': 0.35; 'but': 0.35; 'version': 0.36; 'subject:?': 0.36; 'hi,': 0.36; 'url:org': 0.36; 'skip:o 20': 0.38; 'to:addr:python-list': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'read': 0.60; 'received:173': 0.61; 'absolutely.': 0.84; 'received:fios.verizon.net': 0.84; 'url:reference': 0.84 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Terry Jan Reedy <tjreedy@udel.edu> |
| Subject | Re: how to run another file inside current file? |
| Date | Sat, 18 May 2013 12:39:16 -0400 |
| References | <67c4dd92-7e6a-4955-850b-0c21c2708e05@googlegroups.com> <CAG=aD5aMmunaqXzdP9eUiTg6uQvBjny0xxAbXMD5DCP9-zTocg@mail.gmail.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Gmane-NNTP-Posting-Host | pool-173-75-251-66.phlapa.fios.verizon.net |
| User-Agent | Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130509 Thunderbird/17.0.6 |
| In-Reply-To | <CAG=aD5aMmunaqXzdP9eUiTg6uQvBjny0xxAbXMD5DCP9-zTocg@mail.gmail.com> |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.1807.1368895205.3114.python-list@python.org> (permalink) |
| Lines | 27 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1368895205 news.xs4all.nl 15996 [2001:888:2000:d::a6]:39032 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:45516 |
Show key headers only | View raw
On 5/18/2013 7:15 AM, Kevin Xi wrote:
> Hi,
> It's better to specify version of python you work with.
Absolutely.
I know nothing
> about python 3 but in python 2 you can do this with `exec`. Example:
>
> > f = file('otherFile.py')
> > exec f
Py 2 has execfile that does the above. Py 3 do as above except that exec
is a function.
with open('otherfile.py') as f:
exex(f)
> For more, read the doc:
> http://docs.python.org/2.7/reference/simple_stmts.html#the-exec-statement
> HTH
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
how to run another file inside current file? Avnesh Shakya <avnesh.nitk@gmail.com> - 2013-05-17 21:48 -0700 Re: how to run another file inside current file? Kevin Xi <kevin.xgr@gmail.com> - 2013-05-18 19:15 +0800 Re: how to run another file inside current file? Terry Jan Reedy <tjreedy@udel.edu> - 2013-05-18 12:39 -0400
csiph-web