Re: Searching Sets (Lottery Results)

2016-02-09 Thread MrPink
On Monday, February 8, 2016 at 7:05:24 PM UTC-5, Chris Angelico wrote: > On Tue, Feb 9, 2016 at 8:45 AM, MrPink wrote: > > I load the lottery drawings into memory for searching with the following > > code although, it is incomplete. I am stuck and need some guidance. > >

Searching Sets (Lottery Results)

2016-02-08 Thread MrPink
This is a continuation of my pursuit to learn Python. I have been tinkering with this for a number of years and I am back at it again. I am stuck and need some guidance. This is related to other posts that I have made in the past. For example: Searching for Lottery drawing list of ticket matc

Re: Reading a file into a data structure....

2011-10-15 Thread MrPink
understand a little better what a tuple is and can follow the code better. A namedtuple seems like a dictionary type. I'll need to read up on the difference between the two. Thanks again. On Oct 15, 12:47 am, Chris Rebert wrote: > On Fri, Oct 14, 2011 at 7:59 PM,MrPink wrote: > >

Re: Reading a file into a data structure....

2011-10-14 Thread MrPink
y for key in keys if 20110909 <= key <= 20111212] How would I search for matching wb (White Balls) in the drawings? Is there a better way to organize the data so that it will be flexible enough for different types of searches? Search by date range, search by pb, search by wb matches, etc

How to test if object is an integer?

2011-10-14 Thread MrPink
Is there a function in Python that can be used to test if the value in a string is an integer? I had to make one up for myself and it looks like this: def isInt(s): try: i = int(s) return True except ValueError: return False -- http://mail.python.org/mailman/list

Can I search a list for a range of values?

2011-10-14 Thread MrPink
I have a list like so: a = [2,4,5,6,3,9,10,34,39,59,20,15,13,14] I would like to get a subset from the list with value between 10 and 20 (inclusive). b = [10,13,15,14,20] Is there a way to do this with a list or other data type? Thanks, -- http://mail.python.org/mailman/listinfo/python-list

Reading a file into a data structure....

2011-10-13 Thread MrPink
This is a continuing to a post I made in August: http://groups.google.com/group/comp.lang.python/browse_thread/thread/b072cfadf998deae/ce6d4d09911e4107?lnk=gst&q=MrPink#ce6d4d09911e4107 I got some free time to work with Python again and have some followup questions. For example, I have a lis

Re: How do I convert String into Date object

2011-08-13 Thread MrPink
I found this solution. Python: Convert String Date to Date Object http://slaptijack.com/programming/python-convert-string-date-to-date-object/ On Aug 13, 3:14 pm, MrPink wrote: > Is this the correct way to convert a String into a Date? > I only have dates and no time. > > import ti

Re: How do I convert String into Date object

2011-08-13 Thread MrPink
t; dt1 == dt2 > False >  >>> dt1 > dt2 > False >  >>> dt1 < dt2 > True >  >>> dt1 - dt2 > datetime.timedelta(-1) > > On 13/08/11 21:26, MrPink wrote: > > > > > > > > > I have file of records delimited by spaces. > > I need t

Re: How do I convert String into Date object

2011-08-13 Thread MrPink
ed that my oDate is not an object, but a structure and not a date datatype. I'm stumped. Is there a way to convert a string into a date datatype for comparisons, equality, etc? Thanks, On Aug 13, 3:14 pm, MrPink wrote: > Is this the correct way to convert a String into a Date?

How do I convert String into Date object

2011-08-13 Thread MrPink
Is this the correct way to convert a String into a Date? I only have dates and no time. import time, datetime oDate = time.strptime('07/27/2011', '%m/%d/%Y') print oDate Thanks, -- http://mail.python.org/mailman/listinfo/python-list

Re: Searching for Lottery drawing list of ticket match...

2011-08-12 Thread MrPink
Boy, that was a lot more elegant that I would have thought. Though hard for a greenhorn like me to really understand how the assignment are working, etc. Anyway, what are these kind of statement call so that I can read up more on this? What Python feature are you using? num_whites = ticket_whit

Searching for Lottery drawing list of ticket match...

2011-08-10 Thread MrPink
I need a little nudge into the right direction with this problem. As an exercise for me to learn about Python, I am trying to determine the best way to search a list of "lottery drawings" for a match with a lottery ticket. Possible numbers for a drawing are: 5 whiteballs (wb): 1-55 1 blackball (bb