Re: [Tutor] How to replace the '\'s in a path with '/'s?

2011-07-31 Thread Steven D'Aprano
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 library

Re: [Tutor] How to replace the '\'s in a path with '/'s?

2011-07-31 Thread Steven D'Aprano
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

Re: [Tutor] How to replace the '\'s in a path with '/'s?

2011-07-31 Thread Richard D. Moores
On Sat, Jul 30, 2011 at 23:32, 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 liter

Re: [Tutor] How to replace the '\'s in a path with '/'s?

2011-07-31 Thread Peter Otten
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

Re: [Tutor] How to replace the '\'s in a path with '/'s?

2011-07-31 Thread Sergey
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 readi

Re: [Tutor] How to replace the '\'s in a path with '/'s?

2011-07-31 Thread Richard D. Moores
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('\', '/') > >>                                ^ >

Re: [Tutor] How to replace the '\'s in a path with '/'s?

2011-07-31 Thread Richard D. Moores
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('\', '/') >>>                                ^ >>> Synt

Re: [Tutor] How to replace the '\'s in a path with '/'s?

2011-07-31 Thread Sergey
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)

Re: [Tutor] How to replace the '\'s in a path with '/'s?

2011-07-31 Thread Richard D. Moores
On Sun, Jul 31, 2011 at 08:59, 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 separat

Re: [Tutor] How to replace the '\'s in a path with '/'s?

2011-07-31 Thread Sergey
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" wrote > > Nice! > > I went with > > > import os.pat

Re: [Tutor] How to replace the '\'s in a path with '/'s?

2011-07-31 Thread Steven D'Aprano
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 = re.sub(re.e

Re: [Tutor] How to replace the '\'s in a path with '/'s?

2011-07-31 Thread Sergey
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 wrote

Re: [Tutor] How to replace the '\'s in a path with '/'s?

2011-07-31 Thread Peter Otten
Richard D. Moores wrote: >> What happens if the path looks like >> >> r"C:relative\path\to\my\file.txt" >> >> or >> >> r"C:/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

Re: [Tutor] How to replace the '\'s in a path with '/'s?

2011-07-31 Thread Richard D. Moores
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 > >> > >> r"C:relative\path\to\my\file.txt" > >> > >> or > >> > >> r"C:/mixed\slashes.txt"? > > > > Not quite sure what the intent of your question is, but al

[Tutor] Mailing list documentation

2011-07-31 Thread Alexander Etter
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 _

Re: [Tutor] Mailing list documentation

2011-07-31 Thread Sergey
On Sun, 31 Jul 2011 14:22:41 -0400 Alexander Etter 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 is what is it's > U

[Tutor] How do I learn python for web development

2011-07-31 Thread abdulhakim haliru
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: tutor-bounces+abdulhakim.hal

Re: [Tutor] How do I learn python for web development

2011-07-31 Thread eire1130
There are several books om django. This is what you are looking for Sent from my Verizon Wireless BlackBerry -Original Message- From: "abdulhakim haliru" Sender: tutor-bounces+eire1130=gmail@python.org Date: Sun, 31 Jul 2011 20:22:30 To: Reply-To: abdulhakim.hal...@leproghrammeen.

Re: [Tutor] How do I learn python for web development

2011-07-31 Thread James Thornton
On Sun, Jul 31, 2011 at 3:22 PM, 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. Hi - Start off by becoming familiar with Python -- here are some good online tutorials, in order from introductory to m

Re: [Tutor] How do I learn python for web development

2011-07-31 Thread bob gailer
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 BlackBer

Re: [Tutor] How do I learn python for web development

2011-07-31 Thread Alan Gauld
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, p

Re: [Tutor] Mailing list documentation

2011-07-31 Thread Christopher King
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 wrote: > On Sun, 31 Jul 2011 14:22:41 -0400 Alexander Etter > wrote

Re: [Tutor] Mailing list documentation

2011-07-31 Thread Brett Ritter
On Sun, Jul 31, 2011 at 8:42 PM, Christopher King 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 question. There is no

Re: [Tutor] Mailing list documentation

2011-07-31 Thread Dave Angel
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 suspicious

Re: [Tutor] How do I learn python for web development

2011-07-31 Thread Christian Witts
On 2011/07/31 10:22 PM, 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. Can anyone advice me please. Abdulhakim. Sent from my BlackBerry wireless device from MTN You can try Python 3 Web Development Begi