Re: [Tutor] HTML Parser woes

2014-03-04 Thread Mark Lawrence
On 04/03/2014 16:26, Alan Gauld wrote: My turn to ask a question. This has me pulling my hair out. Hopefully it's something obvious... I'm trying to pull some dates out of an HTML web page generated from an Excel spreadsheet. I've simplified things somewhat so the file(sample.htm) looks like:

Re: [Tutor] HTML Parser woes

2014-03-04 Thread Alan Gauld
On 04/03/14 18:19, spir wrote: As you can see I'm picking up the class attribute and its value but the conditional test for x165 is failing. It's "x L 65", not "x ONE 65". I'm curious what font you use such that you even _can_ confuse '1' and 'l' in reading (modern fonts are made to avoid su

Re: [Tutor] HTML Parser woes

2014-03-04 Thread spir
On 03/04/2014 05:38 PM, Alan Gauld wrote: On 04/03/14 16:31, Steven D'Aprano wrote: On Tue, Mar 04, 2014 at 04:26:01PM +, Alan Gauld wrote: My turn to ask a question. This has me pulling my hair out. Hopefully it's something obvious... [...] And the output looks like: start test Class Va

[Tutor] HTML Parser woes

2014-03-04 Thread Alan Gauld
My turn to ask a question. This has me pulling my hair out. Hopefully it's something obvious... I'm trying to pull some dates out of an HTML web page generated from an Excel spreadsheet. I've simplified things somewhat so the file(sample.htm) looks like: style='border-collapse: collapse;ta

Re: [Tutor] HTML Parser woes

2014-03-04 Thread Steven D'Aprano
On Tue, Mar 04, 2014 at 04:26:01PM +, Alan Gauld wrote: > My turn to ask a question. > This has me pulling my hair out. Hopefully it's something obvious... [...] > And the output looks like: > > start test > Class Value: 'xl66' > Class Value: 'xl66' > Class Value: 'xl66' > Class Value: 'xl

Re: [Tutor] HTML Parser woes

2014-03-04 Thread Alan Gauld
On 04/03/14 16:31, Steven D'Aprano wrote: On Tue, Mar 04, 2014 at 04:26:01PM +, Alan Gauld wrote: My turn to ask a question. This has me pulling my hair out. Hopefully it's something obvious... [...] And the output looks like: start test Class Value: 'xl66' Class Value: 'xl66' Class Val

Re: [Tutor] Help with "Guess the number" script

2014-03-04 Thread Alan Gauld
On 04/03/14 02:29, Scott W Dunning wrote: I’ve made some changes and have a couple questions, I’ll speak in between the code. from random import randrange randrange(1, 101) This call to randrange() doesn't do anything because you don't store the return value. You need to create a variable t

Re: [Tutor] Help with "Guess the number" script

2014-03-04 Thread Danny Yoo
> If not, then you might even try something like: > > # > def maybe_print_cold(): > if guess < (secret - 10) or guess > (secret - 10): > print "You are cold!" > print > print "Please play again!” > # ... Ooops. You proba

Re: [Tutor] Help with "Guess the number" script

2014-03-04 Thread Danny Yoo
Once a function gets beyond about six or seven lines long, it's a bit hard to read, and harder to get the indentation right. You're having difficulty with the indentation, but that's often a sign that the function is too big to read comfortably. Can you break the function down into a few pieces?

Re: [Tutor] Help with "Guess the number" script

2014-03-04 Thread Scott W Dunning
On Mar 3, 2014, at 3:29 AM, spir wrote: I have another question in regard to this guess the number script I’m working on. I’m banging my head over why this isn’t working…. def print_hints(secret, guess): if guess < 1 or guess > 101: print print "Out of range!" prin

Re: [Tutor] Help with "Guess the number" script

2014-03-04 Thread Scott W Dunning
On Mar 3, 2014, at 3:27 AM, spir wrote: > > There are 2 user guesses here, and only 1 variable, thus 1 name. The name > should say what (idea) the variable represents in the program; this should be > said by the name's *meaning*. It is one of the greatest difficulties in > programming. How wo

Re: [Tutor] Help with "Guess the number" script

2014-03-04 Thread Scott W Dunning
On Mar 3, 2014, at 1:51 AM, Ben Finney wrote: > "Bold” assumes that markup of text will survive; that's not reliable, > since this is a text-only medium and only the plain text will reliably > survive to all readers. Sorry, I didn’t realize. I’m still new to this. > > You're creating a prompt s

Re: [Tutor] numerical problem

2014-03-04 Thread Peter Otten
Gabriele Brambilla wrote: > for example I read this: > > On Pythons prior to 2.7 and 3.1, once you start experimenting with > floating-point numbers, you're likely to stumble across something that may > look a bit odd at first glance: 3.1415 * 2 # repr: as code (Pythons < 2.7 and 3.1) > 6.28