This report is out-of-date. The state of things has changed dramatically, for the better, since I first wrote this in early 2008. Although my test cases are still quite useful, any information regarding specific python packages is likely to be inaccurate. I am leaving these pages here primarily for historic interest. As of March 20, 2008 In this report I've attempted to rigorously compare many of
Python でもJSONを使いたい! ということで, 探してみた. こんなページを見つけた. やっぱり山のようにある. どれでもいいから, 標準ライブラリに取り込んでもらいたいものだ. どれを使っても同じみたいな感じなので, ランダムにjson-pyを選んで見た. なかを見てみると, json と minson という全く別の2つのパッケージが入っているようだ. とりあえず, json を使うとこんな感じだ. import json # Python オブジェクトから JSON文字列へ print json.write( python_object ) # JSON 文字列 を Python オブジェクトへ python_object = json.read( json_string ) Pythonオブジェクトといっても, 数値, 文字列, 真偽値, リスト, マッピングオブジェクトし
Pybigi PythonでLivedoor Readerから未読の記事を取得する 概要 大まかな流れ ①cookieを利用してログインする。 ②未読の記事がある配信元のsubscribe_idを取得する。 ③取得したsubscribe_idを元に未読の記事を取得する。 ④既読化する モジュールのインポート =============== import urllib import urllib2 import cookielib import simplejson =============== 最後のsimplejsonは標準のモジュールではないのでインストールする必要がある。またJSONを扱えるなら、他のものでも可。以下ではsimplejsonを利用する。 ログイン http://member.livedoor.com/login/indexにIDとPasswordを送る。またログイン
json – JavaScript Object Notation シリアライザ - Python Module of the Week へ移転しました。
json — JSON encoder and decoder¶ Source code: Lib/json/__init__.py JSON (JavaScript Object Notation), specified by RFC 7159 (which obsoletes RFC 4627) and by ECMA-404, is a lightweight data interchange format inspired by JavaScript object literal syntax (although it is not a strict subset of JavaScript [1] ). Warning Be cautious when parsing JSON data from untrusted sources. A malicious JSON strin
WebAPIで使われるデータ形式JSON。普通はJSON用のパーサーを使うのですけれども、Python組み込み関数のevalで評価できないか考えてみました。 ”結構めんどくさい”ので、専用のモジュールを探して使ったほうが悩まなくてすむかも。 evalを安全に使うのくだりは自分用にメモを保存しておきたかったので、一応公開しておきます。 [pukiwiki] Pythonにて、eval関数を使ってJSONをオブジェクトに変換した場合、容易に思いつく脆弱性は _jsonstr=”__import__(‘sys’).stdout.write(‘HELLO WORLD’)” _ #print “HELLO WORLD”と同じと思って頂きたい _jsondict=eval(jsonstr) コンソールに文字が表示されます。 これを抑制するために、スコープをからっぽにしてみます。 _>>> eval(“
ということで。 Python Stuff # simplejson simplejson - Google Code Python Package Index : simplejson 2.0.5 simplejson -- JSON encoder and decoder -- simplejson v2.0.0 documentation Python では simplejson がスタンダードなのかな ? simplejson 2.0.5simplejson is a simple, fast, complete, correct and extensible JSON encoder and decoder for Python 2.3+. It is pure Python code with no dependencies, but includes an optional C
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く