Re: [Tutor] PyQuery

2011-03-09 Thread Okta Satria
I have basic understanding of dictionary and urllib. http://id.wikipedia.org/wiki/Tabel_perbandingan_ukuran_jarum_hipodermik I extracted the html file from that site by using urllib library. Then, I read PyQuery, it's JQuery-Like. So, I want to extract the content of the table and I want the res

Re: [Tutor] Need help with dates in Python

2011-03-09 Thread Prasad, Ramit
My major problem is your use of datetime. Why are you comparing each day/month/year manually? import datetime >>d = datetime.datetime(2001,01,15) >>c = datetime.datetime(2001,01,14) >>d > c True that makes your entire program look like: max = datetime.date(1900, 1, 1) min = datetime.date(2500, 1

Re: [Tutor] Need help with dates in Python

2011-03-09 Thread James Reynolds
On Wed, Mar 9, 2011 at 1:34 PM, nookasree ponamala wrote: > Hi, > I'm new to Python programming. I've changed the code to below, but still it > is not working, Could you pls. make the corrections in my code. > > import datetime > t = () > tot = [] > min = datetime.date(2008, 1, 1) > max = datetime

Re: [Tutor] Need help with dates in Python

2011-03-09 Thread Steven D'Aprano
nookasree ponamala wrote: Hi, I'm new to Python programming. I've changed the code to below, but still it is not working, Could you pls. make the corrections in my code. If you are to be a programmer, you need to learn how to read the error messages you get. You probably would have seen an er

Re: [Tutor] Need help with dates in Python

2011-03-09 Thread ian douglas
I'm new to the language as well, but I think you're missing your indentation after each of your 'if' conditions? On 03/09/2011 10:34 AM, nookasree ponamala wrote: if t< max: maxyr = max< should be indented if t> min:

Re: [Tutor] Need help with dates in Python

2011-03-09 Thread nookasree ponamala
Hi, I'm new to Python programming. I've changed the code to below, but still it is not working, Could you pls. make the corrections in my code. import datetime t = () tot = [] min = datetime.date(2008, 1, 1) max = datetime.date(2012, 12, 31) for line in open ('test2.txt','r'): data = line

Re: [Tutor] PyQuery

2011-03-09 Thread bob gailer
On 3/9/2011 11:52 AM, Okta Satria wrote: Dear All, I'm new in python programming. Now I'm learning about dictionary and PyQuery. Could someone help me to read this table please: http://id.wikipedia.org/wiki/Tabel_perbandingan_ukuran_jarum_hipodermik end the result is in nested dictionary li

[Tutor] PyQuery

2011-03-09 Thread Okta Satria
Dear All, I'm new in python programming. Now I'm learning about dictionary and PyQuery. Could someone help me to read this table please: http://id.wikipedia.org/wiki/Tabel_perbandingan_ukuran_jarum_hipodermik end the result is in nested dictionary like this: 'Jarum' : 'Guage', 'Perkiraan Diam

Re: [Tutor] Need help with dates in Python

2011-03-09 Thread Andre Engels
On Wed, Mar 9, 2011 at 9:21 AM, nookasree ponamala wrote: > Hi, > > I need help in finding the minimum date and maximum date in a file. > Here is my test file: > s.no:   dt1     amt     id1     id2 > 452     2010-02-20      $23.26      059542        06107 > 452     2010-02-05      $20.78      0595

Re: [Tutor] Need help with dates in Python

2011-03-09 Thread C.Y. Ruhulessin
import datetime min = datetime.date(2008, 1, 1) max = datetime.date(2012, 12, 31) file = open ('test2.txt','r') line = file.readline()[-1] while line: # your code 2011/3/9 nookasree ponamala > Hi, > > I need help in finding the minimum date and maximum date in a file. > Here is my test fil

[Tutor] Need help with dates in Python

2011-03-09 Thread nookasree ponamala
Hi, I need help in finding the minimum date and maximum date in a file. Here is my test file: s.no: dt1 amt id1 id2 452 2010-02-20 $23.26 05954206107 452 2010-02-05 $20.78 05954206107 451 2010-02-24 $5.99 05954220151