Understanding '?' in regular expressions

2012-11-15 Thread krishna . k . kishor3
Can someone explain the below behavior please? >>> re1 = re.compile(r'(?:((?:1000|1010|1020))[ ]*?[\,]?[ ]*?){1,3}') >>> re.findall(re_obj,'1000,1020,1000') ['1000'] >>> re.findall(re_obj,'1000,1020, 1000') ['1020', '1000'] However when I use "[\,]??" instead of "[\,]?" as below, I see a differen

Re: Scalable python dict {'key_is_a_string': [count, some_val]}

2010-03-10 Thread Krishna K
On Fri, Feb 19, 2010 at 11:27 PM, Jonathan Gardner < jgard...@jonathangardner.net> wrote: > On Fri, Feb 19, 2010 at 10:36 PM, krishna > wrote: > > I have to manage a couple of dicts with huge dataset (larger than > > feasible with the memory on my system), it basically has a key which > > is a st

working of round()

2007-04-15 Thread Krishna . K . 1900
Does round() always perfectly return the output expected or are there some artifacts which don't allow perfect functionality Using python 2.5: >>> round(12.234, 2) 12.23 >>> round(12.234, 3) 12.234 >>> round(12.234, 1) 12.199 >>> but was expecting 12.2 Also, for round(x,n), can't 'x'