python 引用自己编写的类

2019年1月31日 22:24 by wst

python小技巧

1, 首先自己写好一个模块如:read_file_class.py

路径为:/home/wst/mylib/python-lib,

内容如下:

#!/usr/bin/env python
import xlrd
#Function:Read records from xls file.
#Depending lib:xlrd
class ReadXlsFile(object):
    def __init__(self,filename):
        self.filename=filename
    def fetch_records(self):
        wb=xlrd.open_workbook(self.filename)
        sheet=wb.sheets()[0]
        records=[]
        for i in range(1,sheet.nrows):
            records.append(sheet.row_values(i))
        return records

2, 当你想要引用这个模块里的类的时候,方式如下:

import sys
sys.path.append(r'/home/wst/mylib/python-lib')
from read_file_class import ReadXlsFile
obj=ReadXlsFile('somefile.xls')
records=obj.fetch_records()

 

参考:http://jingyan.baidu.com/article/e75057f2acd380ebc91a89f0.html


Comments(135) Add Your Comment

alan
不错
grace
正好解决了我的燃眉之急!
Charlesnag
“I haven’t seen you in these parts,” the barkeep said, sidling settled to where I sat. “Designation’s Bao.” He stated it exuberantly, as if say of his exploits were shared by means of settlers about many a verve in Aeternum. He waved to a wooden hogshead apart from us, and I returned his token with a nod. He filled a eyeglasses and slid it to me across the stained red wood of the bar prior to continuing. “As a betting man, I’d be ready to wager a honourable speck of coin you’re in Ebonscale Reach in search more than the wet one's whistle and sights,” he said, eyes glancing from the sword sheathed on my with it to the bend slung across my back. https://www.google.rs/url?q=https://renewworld.ru/budet-li-russkiy-yazyk-v-new-world/
Kevingaw
https://kommstdu-hierher.de/wp-includes/inc/welches_casino_spielt_knossi_.html http://www.unihockey.ch/images/pages/die_besten_casinos_und_hotels_in_las_vegas__nevada__usa_und_wie_viele_es_dort_gibt.html http://www.google.st/url?q=http://cloudbetwelcomebonus.com/fr/ http://www.google.sk/url?sa=t&rct=j&q=&esrc=s&source=web&cd=172&ved=0CCMQFjABOKoB&url=https://1xbitapk.com/ https://images.google.cm/url?q=https://1xbitapk.com/vi/
Vbnboh
order atorvastatin 80mg for sale <a href="https://lipiws.top/">atorvastatin 10mg cost</a> buy lipitor generic
Vhgdaf
buy cipro 1000mg generic - <a href="https://cipropro.top/gemyambutol/">pill ethambutol 1000mg</a> buy cheap generic augmentin
Ckjukj
baycip sale - <a href="https://metroagyl.top/keflexcapsule/">where to buy cephalexin without a prescription</a> purchase amoxiclav for sale
Gyzldm
buy generic ciplox 500mg - <a href="https:/septrim.top/">ciprofloxacin for sale</a> purchase erythromycin sale
Npyvas
order flagyl 200mg - <a href="https://metroagyl.top/oxytetracycline/">terramycin 250mg sale</a> order azithromycin online
Qhafxk
ivermectin 3 mg pills for humans - <a href="https://keflexin.top/tetracycline/">purchase tetracycline online cheap</a> tetracycline 250mg us
Wjepjw
buy stromectol for humans - <a href="https://keflexin.top/aczone/">purchase aczone sale</a> sumycin 500mg pills
Kxnlmr
valtrex uk - <a href="https://gnantiviralp.com/nemasole/">buy nemasole paypal</a> zovirax 400mg over the counter
Hhbjgm
acillin over the counter <a href="https://ampiacil.top/amoxil500/">cost amoxil</a> cheap amoxicillin generic
Glgcpe
buy flagyl 200mg for sale - <a href="https://metroagyl.top/clindamycin/">buy clindamycin pill</a> zithromax 500mg for sale
Ajorkn
buy lasix - <a href="https://antipathogenc.com/medex/">purchase medex online</a> brand captopril
Gidgwj
order glucophage 500mg without prescription - <a href="https://gnantiacidity.com/combivir/">buy combivir pills for sale</a> lincocin 500mg oral
Hsmujc
order generic zidovudine - <a href="https://canadiangnp.com/avapro/">buy irbesartan generic</a> allopurinol 300mg pill
Twcdbb
purchase clozaril without prescription - <a href="https://genonlinep.com/pepcid/">buy pepcid 40mg generic</a> order famotidine without prescription
Rquxsv
buy seroquel 100mg sale - <a href="https://gnkantdepres.com/luvox/">cheap luvox 50mg</a> how to get eskalith without a prescription
Ddbqvw
generic clomipramine 50mg - <a href="https://antdeponline.com/paxil/">order paxil 20mg online cheap</a> buy generic doxepin
Txczgn
hydroxyzine pills - <a href="https://antdepls.com/">purchase hydroxyzine pill</a> endep online
Ahrzij
clavulanate uk - <a href="https://atbioinfo.com/linezolid/">linezolid medication</a> purchase cipro
Uqjcup
amoxil ca - <a href="https://atbioxotc.com/ceftin/">brand ceftin 250mg</a> cipro us
Jyqygj
buy zithromax 250mg - <a href="https://gncatbp.com/">buy zithromax 250mg pills</a> order ciprofloxacin 500mg generic
Ixxdje
clindamycin usa - <a href="https://cadbiot.com/cefixime/">oral suprax 200mg</a> chloromycetin tablet
Phenjr
stromectol buy - <a href="https://antibpl.com/tylquin/">levofloxacin 250mg ca</a> buy cefaclor 250mg pills
Sxkqhb
albuterol 4mg cost - <a href="https://antxallergic.com/dftheo-24/">theo-24 Cr 400 mg canada</a> order theo-24 Cr generic
Rhhiws
medrol 16mg online - <a href="https://ntallegpl.com/montelukast/">montelukast 5mg us</a> buy generic astelin 10ml
Pbjwik
purchase desloratadine online cheap - <a href="https://rxtallerg.com/getzaditor/">zaditor 1mg uk</a> buy albuterol 4mg for sale
Hzlklx
glycomet 1000mg ca - <a href="https://arxdepress.com/sitagliptin50/">order sitagliptin without prescription</a> generic acarbose 50mg
Inzsot
purchase glyburide - <a href="https://prodeprpl.com/">order glyburide 2.5mg generic</a> purchase forxiga generic
Oqzvyv
buy prandin without a prescription - <a href="https://depressinfo.com/">repaglinide 2mg drug</a> empagliflozin 25mg pill
Unzvrr
rybelsus 14 mg over the counter - <a href="https://infodeppl.com/glucovance5/">generic glucovance</a> buy cheap DDAVP
Ksggcr
buy terbinafine 250mg generic - <a href="https://treatfungusx.com/adiflucanv/">diflucan 200mg brand</a> purchase grifulvin v pills
Qyoorv
buy ketoconazole 200mg generic - <a href="https://antifungusrp.com/butenafinecream/">order mentax without prescription</a> itraconazole 100 mg price
Mmospm
famvir order - <a href="https://amvinherpes.com/">purchase famvir pill</a> order valcivir 500mg pill
Aekfzq
digoxin buy online - <a href="https://blpressureok.com/trandate100/">trandate generic</a> buy furosemide diuretic
Ylkyxr
order metoprolol generic - <a href="https://bloodpresspl.com/propranolol/">buy generic inderal 10mg</a> adalat price
Cvrsiq
microzide 25mg ca - <a href="https://norvapril.com/bisoprolol/">bisoprolol order</a> buy bisoprolol 10mg online cheap
Yqjxlr
buy generic nitroglycerin online - <a href="https://nitroproxl.com/clonidinechlorthalidone/">buy combipres generic</a> order valsartan generic
Pbkkqw
order generic zocor - <a href="https://canescholest.com/gemfibrozil/">lopid crash</a> lipitor perceive
Wztagu
rosuvastatin desire - <a href="https://antcholesterol.com/">crestor online shield</a> caduet boy
Jkqqba
buy viagra professional until - <a href="https://edsildps.com/eriacta/">eriacta wit</a> levitra oral jelly online oxford
Ixctfp
priligy lucky - <a href="https://promedprili.com/aurogra/">aurogra hall</a> cialis with dapoxetine our
Nwjhla
cenforce comfort - <a href="https://xcenforcem.com/">cenforce online swarm</a> brand viagra shut
Pxbqsf
brand cialis street - <a href="https://probrandtad.com/apcalissx/">apcalis clue</a> penisole check
Xykgba
brand cialis everywhere - <a href="https://probrandtad.com/alprostadilonline/">alprostadil dirty</a> penisole tide
Jsraef
cialis soft tabs online caution - <a href="https://supervalip.com/levitrasoft/">levitra soft pills div</a> viagra oral jelly online decision
Xrjnjq
cialis soft tabs online meanwhile - <a href="https://supervalip.com/levitrasoft/">levitra soft pills balloon</a> viagra oral jelly online wall
Wdnlhn
priligy damn - <a href="https://promedprili.com/levitrawithdapoxetine/">levitra with dapoxetine absolute</a> cialis with dapoxetine year
Kkrxxj
cenforce online mask - <a href="https://xcenforcem.com/zenegrasildenafil/">zenegra online outer</a> brand viagra pills item
Ijiwsr
asthma medication bulge - <a href="https://bsasthmaps.com/">asthma medication idea</a> inhalers for asthma people
Gspzjc
acne treatment purpose - <a href="https://placnemedx.com/">acne treatment dublin</a> acne treatment bronze
Nvsycq
prostatitis medications cost - <a href="https://xprosttreat.com/">prostatitis treatment carve</a> prostatitis medications jacket
Xbnbhr
uti medication test - <a href="https://amenahealthp.com/">uti medication wound</a> uti antibiotics feeling
Ewwbsu
claritin pills upright - <a href="https://clatadine.top/">loratadine medication sharp</a> loratadine older
Zxtgfi
valtrex pills possibility - <a href="https://gnantiviralp.com/">valacyclovir pills promise</a> valacyclovir pills servant
Oiwmpl
priligy thought - <a href="https://prilixgn.top/">dapoxetine divide</a> priligy social
Cohghb
claritin soon - <a href="https://clatadine.top/">claritin pills toss</a> claritin pills threat
Antffz
ascorbic acid tangle - <a href="https://ascxacid.com/">ascorbic acid beneath</a> ascorbic acid brief
Aayuxe
promethazine wail - <a href="https://prohnrg.com/">promethazine tree</a> promethazine doctor
Cnjnfl
clarithromycin den - <a href="https://gastropls.com/mesalaminepl/">mesalamine pills knee</a> cytotec raise
Xbhpss
florinef armor - <a href="https://gastroplusp.com/prlansoprazole/">prevacid pills convince</a> prevacid pills day
Szwibq
buy aciphex pills for sale - <a href="https://gastrointesl.com/domperidone/">order domperidone 10mg pill</a> domperidone order online
Enlrum
rabeprazole 10mg drug - <a href="https://gastrointesl.com/reglanmetoclop/">buy reglan tablets</a> buy motilium sale
Lxlmpg
bisacodyl 5 mg pill - <a href="https://gastroinfop.com/">buy bisacodyl 5mg online cheap</a> order liv52 20mg online cheap
Ytkfpu
buy zovirax without prescription - <a href="https://cerazestrel.com/">cerazette usa</a> dydrogesterone 10mg us
Juwknu
bactrim canada - <a href="https://cotrioxazo.com/">buy cheap generic bactrim</a> order generic tobrex
Qaktkt
griseofulvin 250mg uk - <a href="https://gemfilopi.com/">buy generic gemfibrozil over the counter</a> cheap gemfibrozil 300mg
Uxrrve
dapagliflozin 10mg brand - <a href="https://precarbos.com/">order acarbose 25mg online cheap</a> buy generic precose
Drohjo
purchase dimenhydrinate sale - <a href="https://bisacolax.com/">order dimenhydrinate 50 mg pills</a> order risedronate 35mg for sale
Zyuflz
enalapril for sale online - <a href="https://doxapisin.com/">cheap doxazosin 1mg</a> buy zovirax online
Niwqbb
etodolac 600mg usa - <a href="https://cilosetal.com/">buy pletal 100 mg for sale</a> pletal buy online
Zhccnc
cost piroxicam 20 mg - <a href="https://rivastilons.com/">exelon 6mg tablet</a> rivastigmine price
Avsuri
nootropil 800mg without prescription - <a href="https://nootquin.com/sinemet/">sinemet 10mg sale</a> sinemet order
Hmooeo
purchase hydrea online - <a href="https://hydroydrinfo.com/indinavir/">indinavir drug</a> buy robaxin 500mg pills
Zwljiw
buy depakote 250mg pills - <a href="https://adepamox.com/mefloquine/">buy cheap mefloquine</a> purchase topiramate online
Binzkx
purchase disopyramide phosphate generic - <a href="https://anorpica.com/">buy norpace generic</a> order thorazine 100mg
Vobvuu
spironolactone 25mg canada - <a href="https://aldantinep.com/dipyridamole/">order persantine</a> generic revia
Xewwoy
order cyclophosphamide - <a href="https://cycloxalp.com/antivert/">buy antivert 25mg sale</a> cheap trimetazidine generic
Ncdcoc
cyclobenzaprine online order - <a href="https://abflequine.com/">flexeril pills</a> pill enalapril 5mg
Ldhfbw
order zofran 8mg pills - <a href="https://azofarininfo.com/selegiline/">eldepryl canada</a> buy requip medication
Krxzjh
ascorbic acid online buy - <a href="https://mdacidinfo.com/prochlorperazine/">prochlorperazine cost</a> compro oral
Rbiosq
purchase durex gel online - <a href="https://xalaplinfo.com/latanoprosteyedrops/">cost zovirax</a> xalatan online buy
Lgzljx
rogaine price - <a href="https://hairlossmedinfo.com/finasteridepros/">buy proscar generic</a> finasteride over the counter
Atrzgq
leflunomide 10mg without prescription - <a href="https://infohealthybones.com/">buy cheap generic arava</a> cheap cartidin without prescription
Pzbvzc
calan online buy - <a href="https://infoheartdisea.com/cardizem/">buy diltiazem for sale</a> tenoretic online
Ybbjla
buy atenolol tablets - <a href="https://heartmedinfox.com/clopidogrel/">order clopidogrel 150mg without prescription</a> coreg for sale online
Zbvcbv
atorvastatin cheap - <a href="https://infoxheartmed.com/lisinopril/">buy lisinopril pills for sale</a> order nebivolol 20mg online cheap
Oscryf
cheap gasex pills - <a href="https://herbalinfomez.com/">buy gasex paypal</a> cheap diabecon tablets
Cxxtpz
where to buy lasuna without a prescription - <a href="https://infoherbalmz.com/himcolin/">himcolin for sale online</a> himcolin generic
Cjjfik
noroxin over the counter - <a href="https://gmenshth.com/flutamide/">eulexin drug</a> confido over the counter
Rgaimg
order speman without prescription - <a href="https://spmensht.com/himplasia/">himplasia where to buy</a> fincar medication
Xueiph
where can i buy speman - <a href="https://spmensht.com/finasteride/">how to buy fincar</a> buy fincar tablets
Fryima
buy finasteride without a prescription - <a href="https://finmenura.com/alfuzosin/">uroxatral buy online</a> alfuzosin online order
Osznwz
hytrin 5mg canada - <a href="https://hymenmax.com/dutasteride/">avodart 0.5mg drug</a> buy dapoxetine 30mg
Itodse
buy trileptal 300mg for sale - <a href="https://trileoxine.com/pirfenidone/">buy generic pirfenex</a> buy generic synthroid online
Apyexw
oral lactulose - <a href="https://duphalinfo.com/betahistine/">order betahistine online cheap</a> buy betahistine 16mg online cheap
Icggot
imusporin without prescription - <a href="https://asimusxate.com/methotrexate/">methotrexate 5mg pills</a> buy gloperba pills
Okxbzs
buy deflazacort without prescription - <a href="https://lazacort.com/brimonidine/">alphagan tubes</a> where to buy alphagan without a prescription
Zmudee
besivance canada - <a href="https://besifxcist.com/">besifloxacin online order</a> buy sildamax pills
Wgoyzy
order generic gabapentin 600mg - <a href="https://aneutrin.com/ibuprofen/">buy motrin 600mg pill</a> azulfidine 500mg usa
Ymessd
purchase benemid sale - <a href="https://bendoltol.com/">buy generic benemid</a> buy tegretol 400mg for sale
Qasxzp
celebrex 200mg brand - <a href="https://celespas.com/flavoxate/">buy flavoxate pills</a> indocin 75mg price
Gkjqdu
generic mebeverine 135 mg - <a href="https://coloxia.com/etoricoxib/">etoricoxib order online</a> buy cheap generic cilostazol
Ftqaqz
generic voltaren 50mg - <a href="https://dicloltarin.com/aspirin/">order aspirin 75 mg online cheap</a> aspirin 75mg cost
Djjszv
rumalaya over the counter - <a href="https://rumaxtol.com/shallaki/">buy shallaki tablets</a> buy elavil 10mg pill
Kridit
buy generic mestinon over the counter - <a href="https://mestonsx.com/azathioprine/">buy imuran 25mg for sale</a> buy cheap generic imuran
Afzvxs
buy diclofenac paypal - <a href="https://vovetosa.com/">cheap voveran pill</a> how to buy nimodipine
Byghlr
buy cheap ozobax - <a href="https://baclion.com/">purchase ozobax for sale</a> feldene 20 mg for sale
Quanut
buy meloxicam 7.5mg sale - <a href="https://meloxiptan.com/">meloxicam order</a> buy ketorolac generic
Afswyi
cyproheptadine 4mg pill - <a href="https://periheptadn.com/">periactin 4mg usa</a> zanaflex price
Wvotyo
cheap artane generic - <a href="https://voltapll.com.com/">buy artane generic</a> buy diclofenac gel online cheap
Hwwrir
cefdinir 300 mg pill - <a href="https://omnixcin.com/">purchase cefdinir pills</a> buy cleocin sale
Yygzzp
isotretinoin 10mg over the counter - <a href="https://aisotane.com/asdeltasone/">brand deltasone 40mg</a> deltasone 40mg tablet
Gnmnfh
deltasone over the counter - <a href="https://apreplson.com/permethrin/">buy elimite cream for sale</a> order elimite creams
Xkbmup
acticin cheap - <a href="https://actizacs.com/">permethrin tablet</a> retin cream usa
Gtfmcu
order betnovate 20gm online - <a href="https://betnoson.com/benoquincre/">generic monobenzone</a> buy monobenzone sale
Jjsdlt
buy cheap metronidazole - <a href="https://cenforcevs.com/">purchase cenforce generic</a> order cenforce 50mg sale
Jiogcs
augmentin 375mg tablet - <a href="https://alevonted.com/">levothyroxine pills</a> buy synthroid 100mcg pills
Lfdvin
buy cleocin 300mg sale - <a href="https://clinycinpl.com/">order cleocin 150mg sale</a> indocin 75mg cost
Pmepio
generic losartan - <a href="https://cozartan.com/">order cozaar pill</a> order keflex 500mg sale
Vkuuww
eurax oral - <a href="https://aeuracream.com/">order crotamiton</a> aczone for sale online
Xxihpl
order modafinil generic - <a href="https://sleepagil.com/">buy modafinil 200mg generic</a> melatonin 3mg for sale
Ahzbsv
where to buy zyban without a prescription - <a href="https://bupropsl.com/shuddhaguggulu/">shuddha guggulu over the counter</a> order shuddha guggulu pills
Ecadej
order xeloda 500mg for sale - <a href="https://xelocap.com/danocrine/">order danocrine 100 mg online</a> danocrine price
Qmvlru
prometrium 100mg without prescription - <a href="https://apromid.com/clomipheneferto/">order fertomid online cheap</a> buy generic fertomid
Plakax
cost alendronate 70mg - <a href="https://pilaxmax.com/medroxyprogesterone/">order medroxyprogesterone sale</a> order provera
Eacwfk
pill norethindrone - <a href="https://norethgep.com/lumigan/">lumigan order online</a> purchase yasmin for sale
Kvizbz
cabergoline order - <a href="https://adostilin.com/cabgolin/">order cabgolin sale</a> order generic alesse
Nfhdfo
buy estradiol 1mg without prescription - <a href="https://festrolp.com/letrozole/">buy letrozole without a prescription</a> order anastrozole 1mg online cheap
Bgisuz
バイアグラジェネリック 通販 - <a href="https://jpedpharm.com/tadalafil/">シアリス は通販での購</a> シアリス 副作用
Avfthw
プレドニン は通販での購 - <a href="https://jpaonlinep.com/">プレドニン は通販での購</a> アジスロマイシン 飲み方
Kajuno
プレドニン 個人輸入 おすすめ - <a href="https://jpanfarap.com/jpadoxycycline/">ドキシサイクリン錠 100 mg 強さ</a> 正規品アキュテイン錠の正しい処方
Wbqder
eriacta listen - <a href="https://eriagra.com/szenegrag/">zenegra mr</a> forzest tom