僕の備忘録(PC、UN*X、ネットワーク関連が中心)なんです。
自分の書いたところは適当(な時とか)に書き換えますので御了承を。
$ python Python 2.6.2 (r262:71600, Aug 23 2009, 21:31:53) [GCC 4.2.4] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> dir() ['Ks', '__builtins__', '__doc__', '__name__', '__package__', 'key', 'rec', 'red', 'squares', 'x'] >>> dir(red) ['__add__', '__class__', '__contains__', '__delattr__', '__delitem__', '__delslice__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__', '__getslice__', '__gt__', '__hash__', '__iadd__', '__imul__', '__init__', '__iter__', '__le__', '__len__', '__lt__', '__mul__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__reversed__', '__rmul__', '__setattr__', '__setitem__', '__setslice__', '__sizeof__', '__str__', '__subclasshook__', 'append', 'count', 'extend', 'index', 'insert', 'pop', 'remove', 'reverse', 'sort'] >>> dir(red.sort) ['__call__', '__class__', '__cmp__', '__delattr__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__le__', '__lt__', '__module__', '__name__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__self__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__']
>>> print round (145.454545, -2) 100.0 >>> print round (145.454545, -1) 150.0 >>> print round (145.454545, -0) 145.0 >>> print round (145.454545, 1) 145.5 >>> print round (145.454545, 2) 145.45 >>> print round (145.454545, 3)
リンクはご自由にどうぞ。でもURLや内容が変った場合はあしからず。