Re: [Tutor] How do I make pattern to find only '.html' file using Python Regular Expression?

2015-04-01 Thread Ben Finney
Abdullah Al Imran writes: > How to do it using Python Regular Expression? Don't assume which tool you must use; instead, ask how best the problem can be solved. In the case of parsing HTML, regular expressions are a poor fit http://stackoverflow.com/questions/1732348/regex-match-open-tags-excep

Re: [Tutor] How do I make pattern to find only '.html' file using Python Regular Expression?

2015-04-01 Thread Alan Gauld
On 01/04/15 20:22, Abdullah Al Imran wrote: I have some HTML content where there are many links as the following pattern: http://example.com/2013/01/problem1.html";>Problem No-1 I want to filter all the links into a list as: ['http://example.com/2013/01/problem1.html', 'http://example.com/201

[Tutor] How do I make pattern to find only '.html' file using Python Regular Expression?

2015-04-01 Thread Abdullah Al Imran
I have some HTML content where there are many links as the following pattern: http://example.com/2013/01/problem1.html";>Problem No-1 I want to filter all the links into a list as: ['http://example.com/2013/01/problem1.html', 'http://example.com/2013/02/problem2.html'] How to do it using Pytho

Re: [Tutor] Python Idioms?

2015-04-01 Thread Steven D'Aprano
On Wed, Apr 01, 2015 at 09:59:30PM +0100, Mark Lawrence wrote: [snip mass quoting] > Yo are of course completely correct, I was conflating two different > threads :) Hey guys, how about trimming some of the excessive quoting in your posts? Especially if you're going to complain about the annoya

Re: [Tutor] Python Idioms?

2015-04-01 Thread Mark Lawrence
On 01/04/2015 18:20, Roel Schroeven wrote: Mark Lawrence schreef: On 01/04/2015 11:50, Alan Gauld wrote: On 01/04/15 11:04, Wolfgang Maier wrote: On 04/01/2015 11:04 AM, Alan Gauld wrote: On 01/04/15 05:50, Jim Mooney wrote: s = [1,2,3,4,5,6,7,8] list(zip(*[iter(s)]*2)) [(1, 2), (3, 4), (5,

Re: [Tutor] Python serial interface

2015-04-01 Thread Mark Lawrence
On 01/04/2015 17:14, Colin Ross wrote: I am using the following controller: http://www.aerotech.com/product-catalog/drives-and-drive-racks/ensemble-mp.aspx Which does not specifically list python as one of the accepted languages, but I guess this does not mean it is not possible. Colin Can

Re: [Tutor] Python Idioms?

2015-04-01 Thread Roel Schroeven
Mark Lawrence schreef: On 01/04/2015 11:50, Alan Gauld wrote: On 01/04/15 11:04, Wolfgang Maier wrote: On 04/01/2015 11:04 AM, Alan Gauld wrote: On 01/04/15 05:50, Jim Mooney wrote: s = [1,2,3,4,5,6,7,8] list(zip(*[iter(s)]*2)) [(1, 2), (3, 4), (5, 6), (7, 8)] Personally I'd have used slici

Re: [Tutor] Python serial interface

2015-04-01 Thread Colin Ross
I am using the following controller: http://www.aerotech.com/product-catalog/drives-and-drive-racks/ensemble-mp.aspx Which does not specifically list python as one of the accepted languages, but I guess this does not mean it is not possible. Colin On Wed, Apr 1, 2015 at 12:58 PM, Colin Ross wr

Re: [Tutor] Python serial interface

2015-04-01 Thread Colin Ross
Thank you Francois, this gives me a lot to think about! I really appreciate your feedback. Colin On Wed, Apr 1, 2015 at 12:50 PM, Francois Dion wrote: > On Wed, Apr 1, 2015 at 11:01 AM, Colin Ross > wrote: > >> Hi Francois, >> >> Thank you for the fast reply! I am looking to control a brushle

Re: [Tutor] Python serial interface

2015-04-01 Thread Francois Dion
On Wed, Apr 1, 2015 at 11:01 AM, Colin Ross wrote: > Hi Francois, > > Thank you for the fast reply! I am looking to control a brushless servo > motor ( > http://www.aerotech.com/product-catalog/motors/rotary-motors/bms-series.aspx) > that drives a rotary stage. > These motors are not controlled

Re: [Tutor] Python serial interface

2015-04-01 Thread Colin Ross
Hi Francois, Thank you for the fast reply! I am looking to control a brushless servo motor ( http://www.aerotech.com/product-catalog/motors/rotary-motors/bms-series.aspx) that drives a rotary stage. Colin On Wed, Apr 1, 2015 at 11:53 AM, Francois Dion wrote: > Pyserial is python 2.x and 3.x co

Re: [Tutor] Python serial interface

2015-04-01 Thread Francois Dion
Pyserial is python 2.x and 3.x compatible. It is very widely used and is stable. http://pyserial.sourceforge.net/ What is your application? Sometimes you can use a higher level module that makes use of pyserial. Francois -- raspberry-python.blogspot.com - www.pyptug.org - www.3DFutureTech.info -

Re: [Tutor] Python serial interface

2015-04-01 Thread Mark Lawrence
On 01/04/2015 15:43, Colin Ross wrote: Hi all, This is a very general question, but I was wondering if anyone has experience using python to interface with a serial port? If so, can you please forward any useful resources? Thanks! Colin http://pyserial.sourceforge.net/ -- My fellow Pythoni

[Tutor] Python serial interface

2015-04-01 Thread Colin Ross
Hi all, This is a very general question, but I was wondering if anyone has experience using python to interface with a serial port? If so, can you please forward any useful resources? Thanks! Colin ___ Tutor maillist - Tutor@python.org To unsubscribe

Re: [Tutor] Python Idioms?

2015-04-01 Thread Mark Lawrence
On 01/04/2015 14:16, Steven D'Aprano wrote: On Wed, Apr 01, 2015 at 12:06:33PM +0100, Mark Lawrence wrote: In which case I'll stick with the more-itertools pairwise() function which I pointed out on another thread just yesterday. From http://pythonhosted.org//more-itertools/api.html Returns

Re: [Tutor] Python Idioms?

2015-04-01 Thread Steven D'Aprano
On Wed, Apr 01, 2015 at 12:06:33PM +0100, Mark Lawrence wrote: > In which case I'll stick with the more-itertools pairwise() function > which I pointed out on another thread just yesterday. From > http://pythonhosted.org//more-itertools/api.html > > > Returns an iterator of paired items, over

Re: [Tutor] Python Idioms?

2015-04-01 Thread Steven D'Aprano
On Tue, Mar 31, 2015 at 09:50:43PM -0700, Jim Mooney wrote: > I'm looking at this and can't see how it works, although I understand > zipping and unpacking. The docs say it's a Python idiom. Does "idiom" mean > it works in a special way so I can't figure it out from basic principles? > It looks to

Re: [Tutor] Python Idioms?

2015-04-01 Thread Dave Angel
On 04/01/2015 12:50 AM, Jim Mooney wrote: I'm looking at this and can't see how it works, although I understand zipping and unpacking. The docs say it's a Python idiom. Does "idiom" mean it works in a special way so I can't figure it out from basic principles? It looks to me like the iterator in

Re: [Tutor] Python Idioms?

2015-04-01 Thread Mark Lawrence
On 01/04/2015 11:50, Alan Gauld wrote: On 01/04/15 11:04, Wolfgang Maier wrote: On 04/01/2015 11:04 AM, Alan Gauld wrote: On 01/04/15 05:50, Jim Mooney wrote: s = [1,2,3,4,5,6,7,8] list(zip(*[iter(s)]*2)) [(1, 2), (3, 4), (5, 6), (7, 8)] Personally I'd have used slicing in this example: zi

Re: [Tutor] Python Idioms?

2015-04-01 Thread Alan Gauld
On 01/04/15 11:04, Wolfgang Maier wrote: On 04/01/2015 11:04 AM, Alan Gauld wrote: On 01/04/15 05:50, Jim Mooney wrote: s = [1,2,3,4,5,6,7,8] list(zip(*[iter(s)]*2)) [(1, 2), (3, 4), (5, 6), (7, 8)] Personally I'd have used slicing in this example: zip(s[::2],s[1::2]) With an emphasis on

Re: [Tutor] Python Idioms?

2015-04-01 Thread Wolfgang Maier
On 04/01/2015 11:04 AM, Alan Gauld wrote: On 01/04/15 05:50, Jim Mooney wrote: s = [1,2,3,4,5,6,7,8] list(zip(*[iter(s)]*2)) [(1, 2), (3, 4), (5, 6), (7, 8)] Personally I'd have used slicing in this example: zip(s[::2],s[1::2]) With an emphasis on *in this example*. The idiom you are cit

Re: [Tutor] Python Idioms?

2015-04-01 Thread Alan Gauld
On 01/04/15 05:50, Jim Mooney wrote: I'm looking at this and can't see how it works, although I understand zipping and unpacking. The docs say it's a Python idiom. Does "idiom" mean it works in a special way so I can't figure it out from basic principles? No idiom means a common pattern of usag

[Tutor] Python Idioms?

2015-04-01 Thread Jim Mooney
I'm looking at this and can't see how it works, although I understand zipping and unpacking. The docs say it's a Python idiom. Does "idiom" mean it works in a special way so I can't figure it out from basic principles? It looks to me like the iterator in the list gets doubled, so the zip should mak