On Sun, May 1, 2011 at 5:49 AM, Ryan Strunk wrote:
> When I initialize the class which holds these dictionaries, though, I need
> to make sure that all the keys contained in d2 match the keys of d1. Thus I
> tried:
> d1 = {'a': 0, 'b': 0, 'c': 0}
> d2 = d1
> My understanding was that d2 looked at
def combine(d1, d2):
for key in d1:
if key in d2:
d2[key] += d1[key]
[Remark]
I usually avoid changing function arguments. But later on you're talking
about using this function as a method a class, so d1 and d2 would be
instance attributes I guess.
When I ini
Hello everyone,
I had an interesting thing come up earlier in my programming, and I'm trying
to wrap my mind around why it occurred.
I wanted to take two dictionaries with the same keys and combine their
values to make one, big super dictionary.
def combine(d1, d2):
for key in d1:
if
someone please tell me why i'm getting this output?
specially the 'e3%' ! ! !
>>> import re
>>> re.findall('([\w]+.)','abdd.e3\45 dret.8dj st.jk')
['abdd.', 'e3%', 'dret.', '8dj ', 'st.', 'jk']
I am getting the same output for the following too..
>>> re.findall(r'([\w]+.)','abdd.e3\45 dret.8dj st.