Re: problems with opening files due to file's path
- From: Mike Driscoll <kyosohma@xxxxxxxxx>
- Date: Tue, 10 Jun 2008 11:50:29 -0700 (PDT)
On Jun 10, 1:25 pm, "Thomas Morton" <morton.tho...@xxxxxxxxxxxxxx>
wrote:
maybe try string substitution... not sure if that's really the BEST way to
do it but it should work
startfile(r"%s"%variable)
I concur. That should work. A slightly more in depth example (assuming
Windows):
os.startfile(r'C:\Documents and Settings\%s\Desktop\myApp.exe' %
username)
or
os.startfile(r'C:\Program Files\%s' % myApp)
Hopefully this is what you are talking about. If you were referring to
passing in arguments, than you'll want to use the subprocess module
instead.
--------------------------------------------------
From: "Alexnb" <alexnbr...@xxxxxxxxx>
Sent: Tuesday, June 10, 2008 7:05 PM
To: <python-l...@xxxxxxxxxx>
Subject: Re: problems with opening files due to file's path
Well, now i've hit another problem, this time being that the path will be
a
variable, and I can't figure out how to make startfile() make it raw with
a
variable, if I put startfile(r variable), it doesn't work and
startfile(rvariable) obviously won't work, do you know how to make that
work
or better yet, how to take a regular string that is given and make every
single "\" into a double "\\"?
<snip>
Mike
.
- Follow-Ups:
- Re: problems with opening files due to file's path
- From: Alexnb
- Re: problems with opening files due to file's path
- References:
- Re: problems with opening files due to file's path
- From: Mike Driscoll
- Re: problems with opening files due to file's path
- From: Thomas Morton
- Re: problems with opening files due to file's path
- Prev by Date: Re: Python for the web
- Next by Date: Re: Web Crawler - Python or Perl?
- Previous by thread: Re: problems with opening files due to file's path
- Next by thread: Re: problems with opening files due to file's path
- Index(es):
Relevant Pages
|