White scenery @showyou, hatena

If you have any comments, you may also send twitter @shsub or @showyou.

Entries from 2008-01-16 to 1 day

こんなの作ってみた

辞書型の辞書型と言うべきか?ただし[a][b]と[b][a]は同じものを指す。 これだと相関取るときに重複のチェックしなくていいかなーって。 class MultiDict: def __init__(self): self.parent = {} def add(self,x,y,value): if self.parent.has_key(x): if se…

多次元辞書

p={'a':{'b':1}} print p['a']['b'] p['a']['c'] = 1 print p raw_input() 出力結果 1 {'a': {'c': 1, 'b': 1}} こうやれば、p["a"]["b"]も出力されるし、p["a"]["c"]=1で新しく要素を作ることもできる。 が、空の状態から突っ込むのはダメっぽい。 ↓はNG. k…