Ruchard,
Try return path.replace('\\', '/'). That gave me the output desired by you.
I don't know the reason. But I guess it's because \ is used as escape
character. I am sure someone in the list will point out the accurate reason.
On Sun, Jul 31, 2011 at 10:58 AM, Richard D. Moores
Try a double backslash
replace('\\','/')
On Jul 30, 2011 10:30 PM, Richard D. Moores rdmoo...@gmail.com wrote:
64-bit Vista
Python 3.2.1
I would like to write a function that would take a path such as
'C:\Users\Dick\Desktop\Documents\Notes\College Notes.rtf'
and return
On Jul 31, 2011, at 1:28, Richard D. Moores rdmoo...@gmail.com wrote:
64-bit Vista
Python 3.2.1
I would like to write a function that would take a path such as
'C:\Users\Dick\Desktop\Documents\Notes\College Notes.rtf'
and return 'C:/Users/Dick/Desktop/Documents/Notes/College Notes.rtf' .
On Sat, Jul 30, 2011 at 10:28:11PM -0700, Richard D. Moores wrote:
File c:\P32Working\untitled-5.py, line 2
return path.replace('\', '/')
^
SyntaxError: EOL while scanning string literal
Process terminated with an exit code of 1
The first backslash up there
Sandip Bhattacharya wrote:
Generally, converting slashes manually should be kept at a minimum. You
should be using library functions as much as possible. The experts here
can correct me here, but this is a roundabout way I would be doing this:
str.replace('\\', '/') is a perfectly fine
Richard D. Moores wrote:
File c:\P32Working\untitled-5.py, line 2
return path.replace('\', '/')
^
SyntaxError: EOL while scanning string literal
Others have already told you how to solve the immediate problem (namely,
escape the backslash), but I'd like to
On Sat, Jul 30, 2011 at 23:32, Sandip Bhattacharya
sand...@foss-community.com wrote:
On Sat, Jul 30, 2011 at 10:28:11PM -0700, Richard D. Moores wrote:
File c:\P32Working\untitled-5.py, line 2
return path.replace('\', '/')
^
SyntaxError: EOL while
Sandip Bhattacharya wrote:
On Sat, Jul 30, 2011 at 10:28:11PM -0700, Richard D. Moores wrote:
File c:\P32Working\untitled-5.py, line 2
return path.replace('\', '/')
^
SyntaxError: EOL while scanning string literal
Process terminated with an exit code of 1
Maybe something useful could be find in urllib? It can open local files. And
UNIX slashes are equal to Web slashes.
http://docs.python.org/release/3.2.1/library/urllib.request.html#urllib.request.URLopener
--
class urllib.request.URLopener(proxies=None, **x509)
Base class for opening and
On Sun, Jul 31, 2011 at 03:34, Peter Otten __pete...@web.de wrote:
Sandip Bhattacharya wrote:
On Sat, Jul 30, 2011 at 10:28:11PM -0700, Richard D. Moores wrote:
File c:\P32Working\untitled-5.py, line 2
return path.replace('\', '/')
^
SyntaxError: EOL
On Sun, Jul 31, 2011 at 03:34, Peter Otten __pete...@web.de wrote:
Sandip Bhattacharya wrote:
On Sat, Jul 30, 2011 at 10:28:11PM -0700, Richard D. Moores wrote:
File c:\P32Working\untitled-5.py, line 2
return path.replace('\', '/')
^
SyntaxError: EOL while
Gotcha!
http://pymon.googlecode.com/svn/tags/pymon-0.2/Internet/rsync.py
231-239 strings
## code ##
def convertPath(path):
# Convert windows, mac path to unix version.
separator = os.path.normpath(/)
if separator != /:
path = re.sub(re.escape(separator),
On Sun, Jul 31, 2011 at 08:59, Sergey ser...@mighty.co.za wrote:
Gotcha!
http://pymon.googlecode.com/svn/tags/pymon-0.2/Internet/rsync.py
231-239 strings
## code ##
def convertPath(path):
# Convert windows, mac path to unix version.
separator = os.path.normpath(/)
if
Haha. Works!
Happy help you.
Ask gurus about regexps. I know they have an opinion about its speed and
optimization. So they can try to criticise. But the problem is solved. It's
good.
On Sun, 31 Jul 2011 09:18:33 -0700 Richard D. Moores rdmoo...@gmail.com
wrote
Nice!
I went with
Sergey wrote:
Gotcha!
http://pymon.googlecode.com/svn/tags/pymon-0.2/Internet/rsync.py
231-239 strings
## code ##
def convertPath(path):
# Convert windows, mac path to unix version.
separator = os.path.normpath(/)
if separator != /:
path =
Nice!
That's what I've been expecting.
Thanks.
Your one string command is tiny and complete. And elegant.
Final desicion?
Or it could be something better and more professional?
So we have removed regexps and everything is fine now. Yes?
On Mon, 01 Aug 2011 02:37:09 +1000 Steven D'Aprano
Richard D. Moores wrote:
What happens if the path looks like
rC:relative\path\to\my\file.txt
or
rC:/mixed\slashes.txt?
Not quite sure what the intent of your question is, but all the paths
I want to modify are full, with only back slashes.
If you invoke your fwd2bk_path_slashes() with
On Sun, Jul 31, 2011 at 10:34, Peter Otten __pete...@web.de wrote:
Richard D. Moores wrote:
What happens if the path looks like
rC:relative\path\to\my\file.txt
or
rC:/mixed\slashes.txt?
Not quite sure what the intent of your question is, but all the paths
I want to modify
Hello everyone, is there a page that contains documentation for this mailing
list? I've seen a few users top post and others advise against it; if there
isn't a page listing conventions let's create it and if there is what is it's
URL and how do you suggest users read it?
Alexander
On Sun, 31 Jul 2011 14:22:41 -0400 Alexander Etter rhettna...@gmail.com wrote
Hello everyone, is there a page that contains documentation for this mailing
list? I've seen a few users top post and others advise against it; if there
isn't a page listing conventions let's create it and if there
Hi guys,
I am really interested in switching from PHP to python but there don't appear
to be a book for such.
Can anyone advice me please.
Abdulhakim.
Sent from my BlackBerry wireless device from MTN
-Original Message-
From: tutor-requ...@python.org
Sender:
There are several books om django. This is what you are looking for
Sent from my Verizon Wireless BlackBerry
-Original Message-
From: abdulhakim haliru abdulhakim.hal...@leproghrammeen.com
Sender: tutor-bounces+eire1130=gmail@python.org
Date: Sun, 31 Jul 2011 20:22:30
To:
On Sun, Jul 31, 2011 at 3:22 PM, abdulhakim haliru
abdulhakim.hal...@leproghrammeen.com wrote:
Hi guys,
I am really interested in switching from PHP to python but there don't appear
to be a book for such.
Hi -
Start off by becoming familiar with Python -- here are some good
online
PLEASE DO NOT HIJACK PRIOR MESSAGES.
New thread? Start a new email.
PLEASE DO NOT SEND A BUNCH OF IRREVELANT TEXT.
Just what is relevant.
On 7/31/2011 4:27 PM, eire1...@gmail.com wrote:
There are several books om django. This is what you are looking for
Sent from my Verizon Wireless
abdulhakim haliru wrote:
Hi guys,
I am really interested in switching from PHP to python
but there don't appear to be a book for such.
I don;t know of any books expressly for converting from PHP to P{ython
web development but there is a lot of documentation on Python web
development,
Wow wow, way is a ser...@might.co.za person doing a tutor response. And why
can I see it if it isn't to me.. I'm sorry Sergey if this
isn't something malicious, it just seems suspicious.
On Sun, Jul 31, 2011 at 3:30 PM, Sergey ser...@mighty.co.za wrote:
On Sun, 31 Jul 2011 14:22:41 -0400
On Sun, Jul 31, 2011 at 8:42 PM, Christopher King g.nius...@gmail.com wrote:
Wow wow, way is a ser...@might.co.za person doing a tutor response.
Assuming you mean _why_ (not _way_) , Sergey was simply quoting the
introductory email we all get when we join, as it answered the
original posters
On 07/31/2011 08:42 PM, Christopher King wrote:
Wow wow, way is a ser...@might.co.za person doing a tutor response. And why
can I see it if it isn't to me.. I'm sorry Sergey if this
isn't something malicious, it just seems suspicious.
(You could try reading it, instead of just getting
28 matches
Mail list logo