随笔分类 -  Python

摘要:The duckduckgo.com's search engine is very neat to use.Acutally it has many things to do with other things since its API is also very neat.We can find many API which are free to use on different platforms. Here we got one for JavaScript on github. "https://github.com/devnulled/duckduckgo-ap 阅读全文
posted @ 2013-11-10 00:44 spaceship9 阅读(1288) 评论(1) 推荐(0)
摘要:SQLAlchemy TrialThis is a great ORM ( Object-Relational Mapper ) which is compatible with xxxx and many others.SQLAlchemy 0.8 Documentationlink: http://docs.sqlalchemy.org/en/rel_0_8/orm/examples.html IMPORTANT TO GO THROUGHObject Relational Tutorialhttp://docs.sqlalchemy.org/en/rel_0_8/ 需要看... 阅读全文
posted @ 2013-09-25 23:05 spaceship9 阅读(349) 评论(0) 推荐(0)
摘要:---恢复内容开始---最近比较火的有digitalocean 的SSD VPS,配置还不错。每个月5刀,512MB内存,CPU被虚拟过。不是KVM。链接能量也不大。节点在西雅图,对环太平洋比较好。但是延迟也能到200多左右。可以选择节点,这个算是对我们最优的节点了。好了。需要的东西,1、paypal或者信用卡账户去买个VPS2、电脑,能操作终端推荐使用linux。或者在windows上使用putty,每个客户端登录的话,都需要rsa.pub 认证的。好了,我已经有了DO的VPS了。剩下的就是去deploy了。We can get help from:http://www.linuxfly.o 阅读全文
posted @ 2013-09-14 01:05 spaceship9 阅读(236) 评论(0) 推荐(0)
摘要:please follow the tutorial from the official site :) http://flask.pocoo.org/docs/You could download the zipped file from this site : 下载离线版doc ,将更加方便查看。You can download the documentation in other formats as well:as PDFas ePubas .mobias zipped HTML要搭建博客,就需要至少有几个工具。1、搭建博客的工具——————python,建议搭配virtualen.. 阅读全文
posted @ 2013-08-08 13:05 spaceship9 阅读(2233) 评论(2) 推荐(0)
摘要:真是很好的东西,有很多有益处的东西。有template引擎,有flask自己带的g (用来处理访问与数据库打开关闭的)有flask自己的处理session的功能自带的jinja2模板引擎也是比较容易懂的。语法也不是很难。模板引擎设计比较科学,也比较符合python之道。即便是博客,也要了解博客的关系。还是比较给力的。提交表单后--》数据发送到数据库--》然后返回一个页面还是原来的带有表单的页面,不过这个表单的页面里面又实打实地是从数据库中取到的数据。在数据库中已经在表单提交的过程后被添加了。很有机的结合在一起。运用模板引擎的extend 拼接够能,能让多个模板相互继承,这真是jinja2的给力 阅读全文
posted @ 2013-08-08 03:16 spaceship9 阅读(402) 评论(0) 推荐(0)
摘要:关于Email的预备知识:原贴地址:http://www.cnblogs.com/lonelycatcher/archive/2012/02/09/2343480.html#########################################################################可以使用Python的email模块来实现带有附件的邮件的发送。SMTP (Simple Mail Transfer Protocol) 邮件传送代理 (Mail Transfer Agent,MTA) 程序使用SMTP协议来发送电邮到接收者的邮件服务器。SMTP协议只能用来发送. 阅读全文
posted @ 2013-07-22 23:59 spaceship9 阅读(2459) 评论(0) 推荐(0)
摘要:I've got some files which can help a little bit to figure out where people are from based on their ID card NO.That file looks like this:Then I converted it into *.csv format which is basically a text file. It's not hard that almost every common document editor has this functionality.Here is 阅读全文
posted @ 2013-06-28 16:40 spaceship9 阅读(616) 评论(0) 推荐(0)
摘要:This tutorial is copied from youtube.comHere is the link: http://www.youtube.com/watch?v=RXqo3lC-JPI&list=PL6-GrNvaJuAhLWFJVwCC2qHCECEWUJtU6&index=5I uploaded it to youku.comHope you guys enjoy it.And here is the source codes:Take notice of the list comprehensions :[v for k, v in something.i 阅读全文
posted @ 2013-06-24 23:52 spaceship9 阅读(910) 评论(0) 推荐(0)
摘要:pythonbottle framework#!/usr/bin/python# -*- coding utf-8 -*-from bottle import route, run, debug, request#from cgi import escape@route('/hello', method='GET')def hello(): name = request.GET.get('name') if not name: name = "This guy's unknow :(" return 'Hell 阅读全文
posted @ 2013-06-24 17:45 spaceship9 阅读(616) 评论(0) 推荐(0)
摘要:how to make them work together?To make jQuery can request to different domain-name server, we use $.ajax and other things.For example here:Basic Ajax in jQuery: http://learn.jquery.com/ajax/jquery-ajax-methods/------------------------ the link above includes examples about how to manipulate json wit 阅读全文
posted @ 2013-06-13 19:58 spaceship9 阅读(586) 评论(0) 推荐(0)
摘要:the lastest Django framework is 1.5.1 while some references are still based on previous distributes.You could find the newest guideness here: https://docs.djangoproject.com/en/1.5/howto/deployment/wsgi/modwsgi/But you may need some old references since the lastest one can't cover most.Here is a 阅读全文
posted @ 2013-06-11 17:56 spaceship9 阅读(454) 评论(0) 推荐(0)
摘要:Hardware InspectionAnd it's datasheet and how to use it.You could download them here lb522 UI 模块开发资料:http://ishare.iask.sina.com.cn/f/37170296.htmlFor more information:http://item.taobao.com/item.htm?spm=a230r.1.14.24.YTYxz0&id=18891415760&_u=23b0km3106cThe Docs of the RFID/NFC module ( 阅读全文
posted @ 2013-06-02 22:21 spaceship9 阅读(460) 评论(0) 推荐(0)
摘要:上一篇文章介绍的是用zip(*data_matrix) ,即便是你使用矩阵,还是要自己加上一些标点符号,括号之类,还是比较复杂的。令人心里痒痒的。总是感觉不够高效,因为我们最平常喜欢做的是复制粘帖。所以做一个能直接读取文档,并且将其输入到数据库中的东西,应该非常好用,这个对某些喜欢做爬虫的网站来说,应该比较有市场。 :D这篇就是来用直接打开文档编辑,来重新创造数组或者元组的。先复习一下上次知识,这里我引用以前的一篇博文的部分内容。http://blog.csdn.net/spaceship20008/article/details/8316983######################## 阅读全文
posted @ 2013-04-20 18:17 spaceship9 阅读(304) 评论(0) 推荐(0)
摘要:其中为了输入一些数据库量表,我不得不到官方网站里面去下载原来数据,然后导入到数据库中。可是发现官方网站给的数据是pdf的,即使是拷贝下来,也是行列不在一起的,这样对将数据整合到数据库中是比较麻烦的。为了不每条数据都一条一条地输入我想出了一个办法。要输入的数据分别在此pdf文档的348 页,349页。复制粘帖到文本文档里面是按照每行每行的。数据并不是按照列来的。即使是复制到libraoffice 中也不能。于是我想出了这个方法这是直接复制的结果:这是我们想要的排列组合,13行,3列 (下载地址:http://wenku.it168.com/d_000144410.shtml分别位于348,349 阅读全文
posted @ 2013-04-20 16:56 spaceship9 阅读(481) 评论(0) 推荐(0)
摘要:http://docs.python.org/2/library/dbhash.html?highlight=.first#database-objects11.10.1. Database ObjectsThe database objects returned byopen()provide the methods common to all the DBM-style databases and mapping objects. The following methods are available in addition to the standard methods.dbhash.f 阅读全文
posted @ 2013-04-17 17:17 spaceship9 阅读(225) 评论(0) 推荐(0)
摘要:有用的文档链接:使用python演绎和使用MQTT协议记得用google---------------------------------------------------------------------------------------------------------------------------------------PythonRequire themosquittoPythonAPIRepeatedly publish (useful for testing)Scrape serial port data, publish on topic信息地址:http://mq 阅读全文
posted @ 2013-04-06 18:26 spaceship9 阅读(1601) 评论(0) 推荐(0)
摘要:引用如下地址的一些文字:http://blog.csdn.net/zfqcn/article/details/7672589网络上一些文章(如《PYTHON编程金典读书笔记》、《PYTHON中的finally》)都讲述try finally与try except不能同时使用,若同时使用,就会出现语法错误。根据我的调查,这些说法早已不合时宜,如本人撰写此文对这个说明修正一下:《PYTHON核心编程》第二版提到,自PYTHON 2.5开始,你可以用 finally 子句与 try-except 或 try-except-else 一起使用. 1 下面是 try-except-else-finall 阅读全文
posted @ 2013-03-29 23:44 spaceship9 阅读(395) 评论(0) 推荐(0)
摘要:python爬取diameizi网页,然后下载图片python 环境是2.7.3代码地址:https://gist.github.com/zjjott/5270366作者讨论地址:http://tieba.baidu.com/p/2239765168?fr=itb_feed_jing#30880553662l需要抓的美女图片地址:http://diameizi.diandian.com/ 1 #coding=utf-8 2 import os 3 os.system("wget -r --spider http://diameizi.diandian.com 2>|log.tx 阅读全文
posted @ 2013-03-29 23:09 spaceship9 阅读(464) 评论(0) 推荐(0)
摘要:什么都不说了,先上代码,代码里面有很详细的解释,参考地址为:http://www.poluoluo.com/jzxy/201210/183913.html这个代码并未使用BeautifulSoup很快我们将使用BeautifulSoup 1 #coding:utf8 2 import urllib2 3 import re 4 url = "http://www.baidu.com/s?wd=steve+jobs" # 百度搜索关键字steve jobs 5 content = urllib2.urlopen(url).read() 6 # 将URL的源码存在conten. 阅读全文
posted @ 2013-03-29 04:27 spaceship9 阅读(1192) 评论(0) 推荐(0)
摘要:网络爬虫 web scraping :)还得复习一下面向对象开发。python的。视频地址:youtube的http://www.youtube.com/watch?v=Ap_DlSrT-iE还有有用的资料http://www.lovelucy.info/python-crawl-pages.html貌似需要了解的东西有urllib, urllib2, urlparse, BeautifulSoup, mechanize, cookielib 等等啦这些库的掌握并不难,网络爬虫难的是你要自己设计压力控制算法,还有你的解析算法,还有图的遍历算法等。还有一些比较有意思的东西:Downloading 阅读全文
posted @ 2013-03-28 02:35 spaceship9 阅读(278) 评论(0) 推荐(0)