码迷,mamicode.com
首页 > 编程语言 > 详细

Python创建二维码通讯录

时间:2017-02-19 00:08:45      阅读:709      评论:0      收藏:0      [点我收藏+]

标签:info   结构   jquery   nim   get   url   wget   card   style   

参考文档:

Python二维码生成库qrcode安装和使用示例:http://www.jb51.net/article/58579.htm

vCard格式参数详细说明:http://www.phpin.net/thread-280-1-1.html

二维码生成工具:http://tools.jb51.net/transcoding/jb51qrcode

 

准备环境:

系统版本:CentOS release 6.5

安装pip:yum install python-pip

安装qrcode: pip install qrcode

安装web.py:官网下载包:web.py-0.40.dev0.tar.gz

安装pil:下载包:wget http://effbot.org/media/downloads/Imaging-1.1.5.tar.gz

 

创建目录:

项目目录:/root/erweima

整个目录结构如下,

[root@IDC-105 erweima]# tree

.

├── static

│   ├── CardImg

│   ├── css

│   │   └── animate.css

│   ├── images

│   │   ├── banner.jpg

│   │   ├── logo.png

│   │   └── sss.png

│   └── js

│       └── jquery.min.js

├── templates

│   └── index.html

├── weixin.py

└── weixin.pyc

 

代码编写:

列出部分代码

[root@IDC-105 erweima]# cat weixin.py

# -*-coding:utf-8 -*-

import web

import qrcode

import time

from PIL import Image

urls = (

    ‘/‘,‘Index‘

)

render = web.template.render(‘templates‘)

def Code(info): 

......

   return imgpath

class Index(object):

    def GET(self):

        return render.index()

    def POST(self):

        info = web.input()

        print info

        return Code(info)

if __name__ ==‘__main__‘:

    web.application(urls,globals()).run()

 

测试:

启动,页面生成二维码

 技术分享

使用微信账号扫码,里面是一个通讯录,可以保存到手机通讯录。(qq也可以扫)

 技术分享 技术分享

 

 

 

Python创建二维码通讯录

标签:info   结构   jquery   nim   get   url   wget   card   style   

原文地址:http://www.cnblogs.com/sunnyyangwang/p/6414391.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!