ãè¾æ¸ã®ãã¼ã¨å¤ãå ¥ãæ¿ããPythonã§ãã£ã¦ã¿ã - çèªåå¿é² - pygoãã®ç¶ãã éããã¾ã£ããèãã¦ãªãã£ã(´・Ïï½¥`)ã®ã§ãæè¿ãã¼ããã¦ã®timeitã¢ã¸ã¥ã¼ã«ã使ã£ã¦è¨æ¸¬ãã¦ã¿ãã import timeit t= timeit.Timer(setup="dict_data = {1: 'a', 2: 'b', 3: 'c', 4: 'd', 5: 'e'}", stmt=""" def d_change_a(d): di = {} for k in d: di[d[k]] = k return dict(di) d_change_a(dict_data) """) print "A-1: ", t.timeit(number = 100000) t= timeit.Timer(setup="dict_data = {1: 'a', 2: 'b', 3: 'c', 4
{{#tags}}- {{label}}
{{/tags}}