例1.构造函数 #-*-coding:utf--*- import sys class Student: def __init__(self,name,age): self.__name=name self.__age=age def getName(self): format="my name is %s my age is %d"%(self.__name,self.__age) print format def __del__(self): print "del&quo…
最近项目中用到二维码图片识别,在python下二维码识别,目前主要有三个模块:zbar .zbarlight.zxing. 1.三个模块的用法: #-*-coding=utf-8-*- import os import logging import zbar from PIL import Image import zxing import random import zbarlight logger=logging.getLogger(__name__) if not logger.handl…
例一:for循环 for i in range(1,100): if i==23: print "great,%s you got your lucky number:" %(i) break else: print 'the number is :',i 运行:windows下 切换到目录下 Python xunhuan.py linux 下 cd到目录下 Python xunhuan.py 例二:阶乘的例子 n=int(input('Enter an integer &…