Skip to content

Commit bf02e01

Browse files
committed
finished 0023, 0024
1 parent be9e6e1 commit bf02e01

File tree

1 file changed

+89
-0
lines changed

1 file changed

+89
-0
lines changed

jiangqideng/python练习题(答案).ipynb

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2361,6 +2361,95 @@
23612361
"print validate_password(hashed, my_password)\n",
23622362
"print validate_password(hashed, '1234567')"
23632363
]
2364+
},
2365+
{
2366+
"cell_type": "markdown",
2367+
"metadata": {},
2368+
"source": [
2369+
"### 第0022题\n",
2370+
"\n",
2371+
"iPhone 6、iPhone 6 Plus 早已上市开卖。请查看你写得 第 0005 题的代码是否可以复用。"
2372+
]
2373+
},
2374+
{
2375+
"cell_type": "code",
2376+
"execution_count": 4,
2377+
"metadata": {
2378+
"collapsed": false
2379+
},
2380+
"outputs": [],
2381+
"source": [
2382+
"from PIL import Image\n",
2383+
"import os\n",
2384+
"imgs_path = r\"C:\\Users\\jiang\\Desktop\\pictures\"\n",
2385+
"picture_size = [64, 100]\n",
2386+
"\n",
2387+
"def change_pic_size(imgs_path, picture_size):\n",
2388+
" for root, dirs, files in os.walk(imgs_path):\n",
2389+
" for f in files:\n",
2390+
" img = Image.open(os.path.join(root, f))\n",
2391+
" img = img.resize(picture_size).save(os.path.join(root, 'rs_' + f), 'jpeg')\n",
2392+
"\n",
2393+
"change_pic_size(imgs_path, picture_size)"
2394+
]
2395+
},
2396+
{
2397+
"cell_type": "markdown",
2398+
"metadata": {},
2399+
"source": [
2400+
"### 第0023题\n",
2401+
"\n",
2402+
"使用 Python 的 Web 框架,做一个 Web 版本 留言簿 应用。\n"
2403+
]
2404+
},
2405+
{
2406+
"cell_type": "code",
2407+
"execution_count": 19,
2408+
"metadata": {
2409+
"collapsed": true
2410+
},
2411+
"outputs": [],
2412+
"source": [
2413+
"# 不想搞web,跳过本题\n",
2414+
"\n",
2415+
"from flask import Flask\n",
2416+
"app = Flask(__name__)\n",
2417+
"\n",
2418+
"@app.route('/')\n",
2419+
"def index():\n",
2420+
" return 'Web 版本 留言簿...'\n",
2421+
"\n",
2422+
"app.run()"
2423+
]
2424+
},
2425+
{
2426+
"cell_type": "markdown",
2427+
"metadata": {},
2428+
"source": [
2429+
"### 第0024题\n",
2430+
"\n",
2431+
"使用 Python 的 Web 框架,做一个 Web 版本 TodoList 应用。"
2432+
]
2433+
},
2434+
{
2435+
"cell_type": "code",
2436+
"execution_count": 20,
2437+
"metadata": {
2438+
"collapsed": false
2439+
},
2440+
"outputs": [],
2441+
"source": [
2442+
"# 不想搞web,跳过本题\n",
2443+
"\n",
2444+
"from flask import Flask\n",
2445+
"app = Flask(__name__)\n",
2446+
"\n",
2447+
"@app.route('/')\n",
2448+
"def index():\n",
2449+
" return 'Web 版本 TodoList 应用...'\n",
2450+
"\n",
2451+
"app.run()"
2452+
]
23642453
}
23652454
],
23662455
"metadata": {

0 commit comments

Comments
 (0)