If you are not redirected automatically, follow this link/a>.
Hello, I started recently some programming in python but I needed to install it first on a windows machine without admin rights.... but how to do it, many forums came to the "portable python" and it works, it is just outdated 3.2.x, and as a good programmer (sigh) I wanted to have the latest of course. The procedure is actually very simple, just download the msi installer from http://www.python.or
pipの使い方 (2014/1バージョン)¶ 以前 pipの使い方 と いう記事を書いたのですが、これは2011年の1月と、ちょうど3年前です。これ から随分変わったので、ここでもう一度まとめたいと思います。 pip: http://www.pip-installer.org/ ここで述べているpipのバージョンは1.5です。お使いのpipのバージョンが古い場合は pip install -U pip として、更新してください。 警告 大きな変更点: pip 1.5から"pre"や"b"などがバージョンに付いているパッ ケージはデフォルトで検索やインストールの対象からはずされました。その ため、1.5未満のバージョンのpipでインストールしたパッケージが1.5では 入らない場合があります。 --pre を付けることで、これらのバージョンを入れることができます。
インポートの基本構文とファイル 構文は次のようになります。 import {.pyを除いたファイル名} #import hogehoge_file ファイルの探索順序 インポート対象ファイルの探索は次の順序で行われます。 実行中のファイルと同じフォルダ カレントフォルダ 環境変数「PYTHONPATH」に列挙したフォルダ sys.pathに登録してあるフォルダ 参考:Pythonのモジュールインポートのしくみ — PythonMatrixJp 探索範囲を拡張する このままでは上記以外のパスにあるファイルをインポートできません。 これを解決するには、探索範囲に指定ディレクトリを追加する必要があります。 rubyでいう $LOAD_PATH.push('/path/to/dir')、 phpでいう set_include_path('/path/to/dir')のようなものだと思います。 py
1. エスケープシーケンスにより表現する文字 Python で、バックスラッシュを文字列として出力したい。 print r'\' しかし、これではシンタックスエラーとなる。 他の言語と同様に、特定の文字の前にバックスラッシュ (\) を付けると、特殊な文字や機能を表わす。 例えば、「改行」を文字列の中に含むには、\n を記述する。 print 'hoge\npiyo' 文字列を出力させた結果は、 hoge piyo `\n’ は改行を表わし、これをエスケープシーケンスと言う。 エスケープシーケンス - Wikipedia とは、 コンピュータシステムにおいて、通常の文字列では表せない特殊な文字や機能を、規定された特別な文字の並びにより表したもの。狭義には、エスケープコード (0x1B, ESC) に始まる一連のバイト列のことをいう。 エスケープシーケンスとして、他に以下のような種類がある。
Python のインストール Windows 7 に Python 開発環境を構築するため,+http://www.python.org/download/ から Python 2.7.2 をダウンロード。(3.2.2 も置いてあるが,2.* と 3.* では Python の仕様が異なるらしい) 具体的には Python 2.7.2 Windows Installer (Windows binary -- does not include source) を落としてきて,インストーラに言われるままに標準構成でインストール。 結果として,C:\ の直下に Python27 というディレクトリが出来ていた。 easy_installのインストール easy_install は各種モジュールを容易にインストールするための仕組みである。具体的には,http://pypi.python.org/p
I've been at this for some time and read many sites on the subject. suspect I have junk lying about causing this problem. But where? This is the error when I import MySQLdb in python: >>> import MySQLdb /Library/Python/2.6/site-packages/MySQL_python-1.2.3c1-py2.6-macosx-10.6-universal.egg/_mysql.py:3: UserWarning: Module _mysql was already imported from /Library/Python/2.6/site-packages/MySQL_pyth
表題そのまんま。 pythonで日本語をエンコードするときに表題のエラーが出たので、その時の対処方法をメモ。 環境: Mac 方法: /usr/lib/python2.6/site.pyの encoding = "ascii" # Default value set by _PyUnicode_Init() をコメントアウトして encoding = "utf-8" # Default value set by _PyUnicode_Init() を追記すればおk なぜかデフォルトのエンコーディングがasciiなってるらしいのでそれをutf-8に変えれば無事動く。 参考にしたURLは下記 http://openlab.dino.co.jp/2007/09/07/18095243.html http://www.ryuzee.com/contents/blog/941 http://d.ha
[Home] [Setting up Mac OS X] [Python]: ファイルを読む [日本語を使う] Python examples - ファイルを読む Python Tutorial にあまり書かれていなかった、「ファイルの読み方」について、例を示します。 対話形式で一行ずつ端末から読む 質問やプロンプトを出して、一行ずつ答えを端末から読む場合は、 raw_input() を使う次の方法が簡単です。 name = raw_input('Enter name: ') print name 標準入力(stdin)から一行ずつ、最後まで読む 標準入力から読むには、sys をimport しておき、sys.stdin を用います。 次の例は、1行ずつ、標準入力から読んで標準出力に書き出します。 (なお、print 文が自分で改行を付け足さないよう、最後にコンマがついています。) #!/
Software development, Cocoa, Objective-C, life. Stuff like that. Portable access to network interfaces from Python Historically it has been difficult to straightforwardly get the network address(es) of the machine on which your Python scripts are running without compromising the portability of your script. As a result, when I needed to do this for the first time, I thought it would be best to writ
[追記] id:Ehren さんが最近のWebSocket事情のまとめ記事を公開されました。 ブラウザの対応関係等わかりやすくて有益です! 最近のWebSocket事情についてまとめとく - Keep on moving HTML5-hack-a-thonに参加しました。 自分の参加しグループは「ニコニコ動画的なもの」を作ろうと言うことで、 コメントが右から流れてくる 映像にエフェクトがつく コメントやエフェクトがリアルタイムに共有出来る といったような内容でCanvasやWebSocketを使ったアプリを作成しました(未完成でしたが、チームの皆さんお疲れさまでした!) 自分はWebSocket周りを担当したので、その時の備忘録を残します。 WebSocketとは 簡単にいうと、サーバがクライアントに対してpushが出来る技術です。 もっと正確に言えば、これまでのAjax等の通信は基本的に
tornado.websocket — Bidirectional communication to the browser¶ Server-side implementation of the WebSocket protocol. WebSockets allow for bidirectional communication between the browser and server. Warning The WebSocket protocol is still in development. This module currently implements the “draft76” version of the protocol, which is supported only by Chrome and Safari. See this browser compatibil
I have been playing around with HTML 5 Web Sockets for a personal project. The Web Sockets API enables web browsers to maintain a bi-directional communication channel to a server, which in turn makes implementing real-time web sites about 1000% easier than it is today. Currently, the only reasonable technical facility available to browsers to communicate to web servers is XMLHttpRequest. Sites tha
まだ深くソースコードを読めていないので「非同期Webサーバー」という言い方が正しいかどうかは自信がない。https://github.com/fiorix/cyclonecycloneはtornadoと非常によく似たAPIをもっている。例えば、お馴染みのHello Worldならば次の通り。 # -*- mode: python -*- # helloworld.tac import cyclone.web from twisted.python import log from twisted.internet import reactor from twisted.application import service, internet class MainHandler(cyclone.web.RequestHandler): def get(self): self.write("He
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く