On Thu, 03 Feb 2011 06:31:49 +, Steven D'Aprano wrote:
On Wed, 02 Feb 2011 20:46:12 -0800, harryos wrote:
In windows ,I tried this
p1 = C:\Users\me\Documents
p2 = ..\Pictures\images\my.jpg
Don't do this; backslash is significant within Python string literals. If
want to use literal
'C:\\Users\\me\\Documents\\..\\Pictures\\images\\my.jpg' is a valid
path. .. means parent, not 'go back a directory'. But you should really
be trying this:
p1 = os.environ['HOMEPATH']
p2 = os.path.join(p1, 'Pictures', 'images', 'my.jpg')
On Wed, 2011-02-02 at 20:46 -0800, harryos wrote:
In
Steven D'Aprano wrote:
BTW, Windows accepts / as well as \ as a path separator. You will have
far fewer headaches if you use that.
Just because Windows accepts / doesn't make it a good idea...
Python 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit
(Intel)] on win32
Type help,
On Thu, 03 Feb 2011 07:58:55 -0800, Ethan Furman wrote:
Steven D'Aprano wrote:
BTW, Windows accepts / as well as \ as a path separator. You will have
far fewer headaches if you use that.
Just because Windows accepts / doesn't make it a good idea...
No. Windows accepting slashes as the
On Thu, 2011-02-03 at 23:11 +, Steven D'Aprano wrote:
On Thu, 03 Feb 2011 07:58:55 -0800, Ethan Furman wrote:
Steven D'Aprano wrote:
BTW, Windows accepts / as well as \ as a path separator. You will have
far fewer headaches if you use that.
Just because Windows accepts / doesn't
At 05:33 PM 2/3/2011, Westley Martínez wrote:
On Thu, 2011-02-03 at 23:11 +, Steven D'Aprano wrote:
On Thu, 03 Feb 2011 07:58:55 -0800, Ethan Furman wrote:
Steven D'Aprano wrote:
[snip]
Yes. Is there a problem? All those paths should be usable from Windows.
If you find it ugly to see
On Thu, 2011-02-03 at 17:57 -0600, Thomas L. Shinnick wrote:
At 05:33 PM 2/3/2011, Westley Martínez wrote:
On Thu, 2011-02-03 at 23:11 +, Steven D'Aprano wrote:
On Thu, 03 Feb 2011
07:58:55 -0800, Ethan Furman wrote:
Steven D'Aprano wrote:
[snip]
Yes. Is there a
On Wed, Feb 2, 2011 at 8:46 PM, harryos oswald.ha...@gmail.com wrote:
In windows ,I tried this
p1 = C:\Users\me\Documents
p2 = ..\Pictures\images\my.jpg
print os.path.join(p1,p2)
This gives
'C:\\Users\\me\\Documents\\..\\Pictures\\images\\my.jpg'
I expected I would get
On Wed, 02 Feb 2011 20:46:12 -0800, harryos wrote:
In windows ,I tried this
p1 = C:\Users\me\Documents
p2 = ..\Pictures\images\my.jpg
print os.path.join(p1,p2)
This gives
'C:\\Users\\me\\Documents\\..\\Pictures\\images\\my.jpg'
I expected I would get