2014年6月29日日曜日

開発環境

Head First Python (Paul Barry(著)、 O'Reilly Media )のChapter 8(Mobile app Development: Small devices)、EXERCISE(p.271)を解いてみる。

EXERCISE(p.271)

コード(BBEdit)

cgi-bin/generate_names.py

#!/usr/bin/env python3
#-*- coding: utf-8 -*-

import athletemodel
import yate
import json

names = athletemodel.get_names_from_store()

print(yate.start_response('application/json'))
print(json.dumps(names))

ブラウザ, Safari(HTML)

http://localhost:8080/cgi-bin/generate_names.py

<html><head></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">
["Vera Vi", "James Lee", "Sarah Sweeney", "Sally Sanchez", "Julie Jones", "Mikey McManus"]
</pre></body></html>

0 コメント:

コメントを投稿