Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #8008
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!tudelft.nl!txtfeed1.tudelft.nl!dedekind.zen.co.uk!zen.net.uk!hamilton.zen.co.uk!reader02.news.zen.co.uk.POSTED!not-for-mail |
|---|---|
| From | Nobody <nobody@nowhere.com> |
| Subject | Re: opening a file |
| Date | Mon, 20 Jun 2011 11:01:19 +0100 |
| User-Agent | Pan/0.14.2 (This is not a psychotic episode. It's a cleansing moment of clarity.) |
| Message-Id | <pan.2011.06.20.10.00.23.375000@nowhere.com> |
| Newsgroups | comp.lang.python |
| References | <mailman.170.1308550055.1164.python-list@python.org> |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | 8bit |
| Lines | 15 |
| Organization | Zen Internet |
| NNTP-Posting-Host | a8df57b8.news.zen.co.uk |
| X-Trace | DXC=:BY8[jMhB_okIQlb@g3\?fYjZGX^207Pk`<MJMoM3PFmIoCl>@HC;obNQ<`Sf8^TaoTcjZU1>>UPh |
| X-Complaints-To | abuse@zen.co.uk |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:8008 |
Show key headers only | View raw
On Sun, 19 Jun 2011 23:00:38 -0700, Tim Hanson wrote:
> This works:
> infile=open('/foo/bar/prog/py_modules/this_is_a_test','r')
>
> This doesn't:
> infile=open('~/prog/py_modules/this_is_a_test','r')
>
> Can't I work with files using Unix expressions?
The argument is treated literally, just like C's fopen() etc. If you want
substitions, you have to perform them explicitly, e.g.:
infile=open(os.path.expanduser('~/prog/py_modules/this_is_a_test'),'r')
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
opening a file Tim Hanson <tjhanson@yahoo.com> - 2011-06-19 23:00 -0700 Re: opening a file Nobody <nobody@nowhere.com> - 2011-06-20 11:01 +0100
csiph-web