上一页 1 2 3 4 5 6 7 8 ··· 48 下一页
摘要: from flask import Flaskfrom flask import render_templatefrom flask import requestapp=Flask(__name__)@app.route('/')def index(): return "hello,word"@app.route('/test')def test(): return "test!"@app.route('/post/')def show_user(user_id): return "userid: 阅读全文
posted @ 2014-03-21 16:38 墨迹哥's 阅读(237) 评论(0) 推荐(0)
摘要: 非常有必要学习一个框架,因为我看到好多应用慢慢都要走python的方向。有两个可选的框架,一个是django一个是flask两者对比下来我发现flask比较轻量级。所以选择这个入门,以后再慢慢扩展。from flask import Flaskapp=Flask(__name__)@app.route('/')def index(): return "hello,word"@app.route('/test')def test(): return "test!"@app.route('/post/')def 阅读全文
posted @ 2014-03-21 10:19 墨迹哥's 阅读(358) 评论(0) 推荐(0)
摘要: 时间有些多,所以把以前视频教程的C复习一下。刚好WZT愿意指点,我就按照这个目标走下去。突然想到随机数的问题,就写了个DEMO。#include#includeint main(){ int a=0; int i=0; srand(time(NULL)); for(i=0;i<10;i++){ printf("%d\n",(int)(10/(float)RAND_MAX * rand())+50); }} 阅读全文
posted @ 2014-03-13 10:05 墨迹哥's 阅读(146) 评论(0) 推荐(0)
摘要: 有想法重写了。把一些结构写出来。。class Crawler(object): def __init__(self,url,depth,threadNum,dbfile,key): #要获取url的队列 self.urlQueue = Queue() #读取的html队列 self.htmlQueue = Queue() #已经访问的url self.readUrls = [] #未访问的链接 self.links = [] #线程数 self.threadNum = threadNum ... 阅读全文
posted @ 2014-03-11 17:31 墨迹哥's 阅读(356) 评论(0) 推荐(0)
摘要: 晚上回来睡不着,随便写了下。 1 #!/usr/bin/python 2 #condig:utf-8 3 import threading,time 4 5 def sayhello(): 6 print "test!!" 7 #time.sleep(1) 8 9 for i in range(100): 10 i=threading.Thread(target=sayhello) 11 i.start() 阅读全文
posted @ 2014-03-08 00:27 墨迹哥's 阅读(229) 评论(0) 推荐(0)
上一页 1 2 3 4 5 6 7 8 ··· 48 下一页