You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert
このページは、Rubyレシピブック (詳細) をPythonで書こうというたくらみです。内容は当たり前のことばかりですが、たまにしかコードを書かない人間は、こうしたことがわからなくてイライラしてしまいます。10行くらいのプログラムならさっと見てさっとかけるようにするのが目標です。 2008年1月21日19:00 ロボットによる荒らし対策を施しました。 レシピブック作成にご協力いただける方がいらっしゃいましたら、最初にユーザー登録をお願いします。 レシピブックを修正する際は、一度ログインをしてください。ログインすると右肩の部分に編集の項目が現れます。 記述方法は、structuredText もしくはreStructuredText でお願いできればと思います。 WEB上の情報 Python クイックリファレンス日本語訳 pythonライブラリリファレンス pythonチュートリアル Per
Seaborn is a Python data visualization library based on matplotlib. It provides a high-level interface for drawing attractive and informative statistical graphics. For a brief introduction to the ideas behind the library, you can read the introductory notes or the paper. Visit the installation page to see how you can download the package and get started with it. You can browse the example gallery
pasterでsetuptoolsを使った最小プロジェクトを作成する。 paster create hellosetup.pyを編集。 コマンドツールのスクリプトを追加する。 ここでは、helloモジュールのhello関数をpyhelloという名前のコマンドにする。 entory_pointsにconsole_scriptsセクションを作りその中に追加する。 from setuptools import setup, find_packages import sys, os version = '0.0' setup(name='hello', version=version, description="", long_description="""\ """, classifiers=[], # Get strings from http://www.python.org/pypi?%3
Flowp 1.2.1¶ Flowp is a library which tries to bring the best ideas from Ruby / node.js world to Python making development more fun. For version 1.2.1 module flowp.testing is available which allows to write tests in a RSpec BDD style with minimum of magic and flowp.files module which brings convenient utils for files processing.
About¶ konch is a CLI and configuration utility for the Python shell, optimized for simplicity and productivity. Automatically import any object upon startup Simple, per-project configuration in a single file (it’s just Python code) Uses IPython, BPython, or ptpython if available, and falls back to built-in interpreter Automatically load IPython extensions Example Use Cases¶ If you’re building a w
以前ブログに書いたparameterized testがPython2.7で実装されるという事が気になり始めたので、おもむろにPython2.7b2のWhat's Newの章を読んでみた。 すると、unittest2というパッケージが外部ライブラリとしてあるようだ。 urllib2的なノリかと思ってみたら、2.7で実装される機能のバックポートらしい。 一足先に使いたい人はeasy_installでインスコしてね! 簡単なまとめ 2.7b2の公式ドキュメントから簡単にまとめてみた。 unittest2も多分同じ感じで使えると思う。 詳細はunittest2の使い方を見てくださいませ。 http://www.voidspace.org.uk/python/articles/unittest2.shtml また、訳が間違ってるなどあったら指摘お願いいたしまする。 py.testやnoseほど強力
下記のような辞書型があり、辞書の値の最大値を持つキーを取得したい。 例えば、下記のような辞書だ。 d = {'a': 1, 'b': 2, 'c': 3} 上記例では、 3 が最大値。よって、 c を得たい。 ここで if文のような条件分岐をつかった実装は クールではないのは容易に想像がつく。 ちなみに、最大値は、組み込み関数の max で取得できる。 >>> max(d.values()) 3 とやると、3 を取得することはできるが、そのキーはどうすれば取得できるだろう。 Python ではどのような実装がクールなのだろうか、とつぶやいたら RT され 一瞬で Reply をいくつかいただけた。 ありがたく、ご紹介させて頂く。 (一応、Python 2.7.5 を想定したのだが、明示しなかったので py3向けの回答もあったのかもしれない) 1. タプルにして最大値を求める実装 >>> m
Python3.4のSingle-dispatchで遊んでみた - Python Advent Calendar 2013 Python Advent Calendar 2013 の 1 日目を担当します、 @hirokiky です。 昨年 に引き続きPythonAdventCalendarを主催しています。 ちなみに今年は現時点であと 4 人参加者が足りません!ぜひご参加ください Python Advent Calendar 2013 さて、今年の Python Advent Calendar のテーマは ‘Not Web’ ということなので、 Web に限らない話を書きます。 つい最近の11月24日に Python 3.4 の Beta 1 がリリースされました。 Python 3.4 b1 には無事 ensure-pip も入り、いよいよ Python 3 感が増してきました。 そん
『Rubyによるデザインパターン』(ラス・オルセン著 ピアソン・エデュケーション刊)をPythonで書いています。 目次 変化しない部分は基底クラスに書き、 変化する部分は抽象メソッドにしてサブクラスに任せようというもの。 例:レポートを出力するクラス。 HTMLを出力するクラスを作ったら、後からプレーンテキストでも出力してくれと言われてしまった。 とりあえず、フォーマットを引数で指定するようにしたら・・・ #template_method1.py class Report: def __init__(self): self.title = u"月次報告" self.text = [u"順調", u"最高"] def output_report(self, format): if format == "plain": print("*** %s ***"%(self.title)) eli
Python 3 からは一部の関数がイテレータを返すよう変更になったということなので、この機会にPython3を触りつつitertoolsモジュールについてひととおり学んでみた。 主に参考にしたのは9.7. itertools — 効率的なループ実行のためのイテレータ生成関数 — Python 2.6ja2 documentation。そのため添えてあるメモは基本的にpython2.6が前提。2.7や3.2で追加されたり変更された点があればその旨を適宜書いてあります。 print関数について 今回はPython3.2であれこれしたのでprint関数を使ってます。Python2.6以降で print("", end=" ") みたいなのを使うには from __future__ import print_function とする必要があります。 バージョン毎のメソッドの実装状況 それぞれのバ
Python Google Chart About pygooglechart is a complete Python wrapper for the Google Chart API. Examples Click on the chart images below to see the source code used to create the chart. Documentation Documentation and examples are slowly progressing. ChangeLog Example Code Installation pygooglechart works with Linux, Windows and Mac OS X. Binary Installers Source Install There are a few ways of ins
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く