python 文件读写练习

2022年5月4日 20:31 by wst

python小技巧

最近在看一个python的书,比较基本,顺手做了下里面的练习题。

 

题目:

创建一个叮咚客服管理系统的界面,每次登录时,将用户的登录日志写入文件中,并且在程序中查看用户的登录日志。

 

答案:

import datetime

FN = "a.log"

def write_log(content):
    with open(FN, "a+") as fp:
        dt = datetime.datetime.now().strftime("%Y-%m-%d %X")
        fp.write(dt + " " + content + "\n")

def login():
    print("请输入用户名和密码:")
    username = input("用户名:")
    password = input("密码:")
    if username == "张三" and password == "123456":
        write_log("[{}]登录成功!".format(username))
    else:
        write_log("登录失败!")

def look_log():
    con = open(FN).read()
    print(con)


if __name__ == "__main__":
    sel = input("请输入你的操作:1--登录,2--查看日志")
    if sel == str(1):
        login()
    elif sel == str(2):
        look_log()

 


Comments(125) Add Your Comment

Ifoksm
atorvastatin 80mg cheap <a href="https://lipiws.top/">purchase lipitor generic</a> atorvastatin 80mg ca
Ezsfcs
order cipro pills - <a href="https://metroagyl.top/azithromycin/">buy clavulanate</a> clavulanate tablet
Yzqrwc
order ciprofloxacin 1000mg without prescription - <a href="https://cipropro.top/gemyambutol/">ethambutol drug</a> augmentin 375mg pills
Ucftkr
order flagyl 400mg pill - <a href="https://metroagyl.top/azithromycin/">buy cheap zithromax</a> zithromax 500mg cost
Mojkya
ciplox medication - <a href="https:/septrim.top/">order ciplox 500 mg generic</a> buy generic erythromycin over the counter
Budauc
cheap valtrex - <a href="https://gnantiviralp.com/diltiazem/">buy generic diltiazem for sale</a> order acyclovir 400mg pills
Pcbtqf
ivermectin for human - <a href="https://keflexin.top/amoxiclav/">buy amoxiclav tablets</a> order tetracycline 500mg generic
Trfhot
cheap metronidazole 200mg - <a href="https://metroagyl.top/keflexcapsule/">cheap amoxicillin generic</a> order zithromax sale
Efxgbr
buy ampicillin for sale <a href="https://ampiacil.top/doxycyclineantb/">order doxycycline generic</a> how to buy amoxicillin
Riszpz
buy furosemide pills - <a href="https://antipathogenc.com/capoten/">captopril 25 mg uk</a> generic captopril 25 mg
Prgidx
glucophage order online - <a href="https://gnantiacidity.com/">order glucophage pills</a> buy generic lincocin
Ermcaj
buy retrovir 300 mg generic - <a href="https://canadiangnp.com/">purchase glucophage without prescription</a> buy allopurinol 100mg generic
Saivyq
clozaril pills - <a href="https://genonlinep.com/frumil/">cheap frumil</a> buy generic famotidine
Ndyxpy
where to buy quetiapine without a prescription - <a href="https://gnkantdepres.com/geodon/">buy geodon sale</a> buy eskalith tablets
Teuejl
order anafranil without prescription - <a href="https://antdeponline.com/cymbalta/">order cymbalta 20mg generic</a> sinequan 25mg tablet
Dlfaga
order atarax online - <a href="https://antdepls.com/pamelor/">buy generic pamelor</a> endep 10mg brand
Yglbdt
amoxil drug - <a href="https://atbioxotc.com/cefadroxil/">duricef 250mg for sale</a> buy ciprofloxacin paypal
Bwhloc
amoxiclav pill - <a href="https://atbioinfo.com/ciprofloxacin/">cipro 500mg pills</a> cipro 1000mg cost
Uttuma
order cleocin 150mg pill - <a href="https://cadbiot.com/cefixime/">buy cefixime 100mg</a> purchase chloramphenicol generic
Lrblbf
zithromax 500mg for sale - <a href="https://gncatbp.com/ctinidazole/">tindamax 500mg without prescription</a> ciplox 500mg sale
Daxfkn
buy ivermectin 3 mg for humans - <a href="https://antibpl.com/aqdapsone/">order aczone gel</a> buy cefaclor no prescription
Gxwczd
buy albuterol online - <a href="https://antxallergic.com/dftheo-24/">purchase theophylline generic</a> theo-24 Cr over the counter
Wwqlxr
buy desloratadine sale - <a href="https://rxtallerg.com/ventolinpill/">albuterol over the counter</a> buy albuterol 2mg online
Glhauf
methylprednisolone sale - <a href="https://ntallegpl.com/montelukast/">singulair 10mg canada</a> purchase azelastine sprayer
Hlxzwy
micronase 2.5mg generic - <a href="https://prodeprpl.com/pioglitazone30/">pioglitazone 30mg price</a> dapagliflozin 10 mg us
Tjkfcn
buy repaglinide 1mg - <a href="https://depressinfo.com/">generic repaglinide 2mg</a> buy jardiance 10mg
Qeavlg
glycomet online order - <a href="https://arxdepress.com/acarbose50/">purchase acarbose generic</a> purchase acarbose online cheap
Oqcgco
lamisil without prescription - <a href="https://treatfungusx.com/xgrifulvinvs/">griseofulvin generic</a> griseofulvin pills
Sybuhy
buy semaglutide 14mg - <a href="https://infodeppl.com/glucovance5/">glucovance usa</a> purchase desmopressin without prescription
Xurhjh
buy ketoconazole for sale - <a href="https://antifungusrp.com/">buy generic nizoral</a> order itraconazole for sale
Qbocce
famvir buy online - <a href="https://amvinherpes.com/acyclovircream/">zovirax generic</a> cost valcivir 500mg
Lbiqwt
buy digoxin 250mg pill - <a href="https://blpressureok.com/">order generic lanoxin 250mg</a> furosemide medication
Grxgys
buy generic hydrochlorothiazide for sale - <a href="https://norvapril.com/amlodipine/">norvasc 10mg drug</a> zebeta ca
Aecctr
metoprolol 100mg sale - <a href="https://bloodpresspl.com/olmesartan/">order benicar 10mg generic</a> buy nifedipine 30mg online
Awccpu
nitroglycerin ca - <a href="https://nitroproxl.com/catapres/">clonidine tablet</a> diovan canada
Maedvs
crestor peculiar - <a href="https://antcholesterol.com/pravastatin/">pravastatin buy gentlemen</a> caduet pills waist
Zcojek
simvastatin owl - <a href="https://canescholest.com/gemfibrozil/">lopid kitty</a> atorvastatin slip
Cyvvpk
viagra professional magical - <a href="https://edsildps.com/cialisprofessional/">buy cialis professional duty</a> levitra oral jelly online caution
Kqrfui
dapoxetine handsome - <a href="https://promedprili.com/fildena/">fildena abroad</a> cialis with dapoxetine pavement
Wrtdwi
cenforce silent - <a href="https://xcenforcem.com/tadalissxtadalafil/">tadalafil 10mg cheap</a> brand viagra pills confuse
Zjkzfs
brand cialis free - <a href="https://probrandtad.com/apcalissx/">apcalis throb</a> penisole street
Dwksye
cialis soft tabs online boil - <a href="https://supervalip.com/cialisoraljelly/">cialis oral jelly always</a> viagra oral jelly mound
Infnso
brand cialis perfect - <a href="https://probrandtad.com/viagrasofttabs/">viagra soft tabs fist</a> penisole delay
Nxywno
cialis soft tabs pills land - <a href="https://supervalip.com/cialisoraljelly/">cialis oral jelly pills anger</a> viagra oral jelly online consider
Pwmdla
cenforce pole - <a href="https://xcenforcem.com/">cenforce online focus</a> brand viagra online innocent
Leqyds
acne medication form - <a href="https://placnemedx.com/">acne medication space</a> acne medication stephen
Wpiuel
asthma treatment head - <a href="https://bsasthmaps.com/">asthma medication gown</a> asthma medication inform
Zoiegv
uti medication gentleman - <a href="https://amenahealthp.com/">uti treatment experience</a> uti antibiotics overcome
Ibjxoz
prostatitis treatment scale - <a href="https://xprosttreat.com/">prostatitis treatment play</a> prostatitis treatment strict
Edorvq
valtrex online blanket - <a href="https://gnantiviralp.com/">valtrex pills corpse</a> valtrex uneasy
Bekief
loratadine pursue - <a href="https://clatadine.top/">claritin cure</a> claritin amazement
Mnqhti
loratadine possible - <a href="https://clatadine.top/">claritin log</a> loratadine dismal
Abqcco
dapoxetine stre - <a href="https://prilixgn.top/">dapoxetine prey</a> dapoxetine around
Vudrzo
promethazine perish - <a href="https://prohnrg.com/">promethazine achieve</a> promethazine swim
Gzbfnd
ascorbic acid mix - <a href="https://ascxacid.com/">ascorbic acid fond</a> ascorbic acid superior
Fzahkn
biaxin pills dick - <a href="https://gastropls.com/">biaxin pills lesson</a> cytotec pills prospect
Gzsksx
florinef unit - <a href="https://gastroplusp.com/prlansoprazole/">lansoprazole pills pat</a> prevacid pills sip
Qtgtnf
bisacodyl 5mg usa - <a href="https://gastroinfop.com/">order bisacodyl 5 mg without prescription</a> buy liv52 without prescription
Ogxaps
buy rabeprazole sale - <a href="https://gastrointesl.com/">aciphex 20mg uk</a> order motilium
Epcymc
buy cotrimoxazole for sale - <a href="https://tobmycin.com/">order generic tobrex 10mg</a> tobra 10mg ca
Sobqed
buy zovirax without a prescription - <a href="https://cerazestrel.com/">cerazette cost</a> dydrogesterone online order
Boclau
pill forxiga - <a href="https://forpaglif.com/">buy forxiga 10mg</a> acarbose price
Hqhykh
fulvicin 250 mg tablet - <a href="https://dipyrilx.com/">order dipyridamole 100mg generic</a> order lopid 300 mg
Kvnmwj
buy enalapril sale - <a href="https://xalanoprost.com/">purchase zovirax generic</a> buy latanoprost medication
Tczqri
order dramamine 50 mg for sale - <a href="https://bisacolax.com/">buy cheap generic dimenhydrinate</a> risedronate 35 mg cheap
Dowihx
monograph 600mg brand - <a href="https://etodograph.com/">etodolac sale</a> brand pletal 100 mg
Qanljm
piroxicam 20 mg cheap - <a href="https://rivastilons.com/">purchase exelon</a> buy rivastigmine online cheap
Yenesv
order piracetam generic - <a href="https://nootquin.com/levofloxacin/">levofloxacin 250mg canada</a> sinemet 20mg generic
Nqkeqb
buy generic hydrea over the counter - <a href="https://hydroydrinfo.com/pentoxifylline/">buy trental for sale</a> robaxin cheap
Akduao
divalproex 250mg tablet - <a href="https://adepamox.com/mefloquine/">buy generic lariam</a> buy topamax 100mg online cheap
Yzrtoe
order disopyramide phosphate online - <a href="https://anorpica.com/">buy generic norpace</a> thorazine 100mg over the counter
Aizlan
order cyclophosphamide pill - <a href="https://cycloxalp.com/atomoxetine/">strattera uk</a> buy trimetazidine tablets
Ziijli
buy aldactone 100mg sale - <a href="https://aldantinep.com/">buy aldactone 100mg for sale</a> naltrexone 50mg pill
Djyiye
where can i buy cyclobenzaprine - <a href="https://abflequine.com/donepezil/">where can i buy donepezil</a> vasotec us
Tddsqp
buy zofran 4mg - <a href="https://azofarininfo.com/">buy cheap zofran</a> requip 2mg tablet
Capxnm
ascorbic acid 500mg uk - <a href="https://mdacidinfo.com/ciprofloxacin/">buy ciprodex ophthalmic solution for sale</a> purchase compro
Gtvazw
purchase durex gel - <a href="https://xalaplinfo.com/">purchase durex gel</a> latanoprost uk
Judafl
buy leflunomide 10mg pill - <a href="https://infohealthybones.com/alfacalcidol/">purchase alfacip online</a> cartidin online order
Wzlkag
order minoxidil for sale - <a href="https://hairlossmedinfo.com/finasteridefinp/">order finpecia online cheap</a> buy propecia 1mg generic
Apqqhe
buy atenolol paypal - <a href="https://heartmedinfox.com/">buy atenolol 50mg pills</a> purchase coreg
Hlglyk
buy verapamil pills - <a href="https://infoheartdisea.com/valsartan/">valsartan 80mg usa</a> order tenoretic generic
Jvhmcj
atorvastatin online buy - <a href="https://infoxheartmed.com/nebivolol/">bystolic 5mg pill</a> bystolic 5mg ca
Jxdnxz
how to get lasuna without a prescription - <a href="https://infoherbalmz.com/">cheap lasuna sale</a> buy cheap himcolin
Hepngp
buy norfloxacin online cheap - <a href="https://gmenshth.com/flutamide/">buy generic eulexin</a> buy confido for sale
Meysdy
buy speman no prescription - <a href="https://spmensht.com/finasteride/">buy fincar medication</a> cost fincar
Ircrmn
finasteride buy online - <a href="https://finmenura.com/doxazosin/">purchase doxazosin online</a> buy alfuzosin pills
Ybprsi
hytrin 5mg pills - <a href="https://hymenmax.com/tamsulosin/">order tamsulosin 0.4mg online</a> cost priligy 30mg
Rhspcw
oxcarbazepine 300mg over the counter - <a href="https://trileoxine.com/levothyroxine/">levoxyl for sale online</a> purchase levothroid pill
Agztyn
how to get lactulose without a prescription - <a href="https://duphalinfo.com/">duphalac bottless</a> betahistine 16 mg uk
Twbtab
imusporin without prescription - <a href="https://asimusxate.com/methotrexate/">methotrexate ca</a> colcrys 0.5mg cost
Qdplqj
how to get calcort without a prescription - <a href="https://lazacort.com/brimonidine/">purchase alphagan</a> alphagan without prescription
Mgnfax
order besifloxacin for sale - <a href="https://besifxcist.com/carbocysteine/">carbocysteine cost</a> buy sildamax
Ptpjlk
order benemid for sale - <a href="https://bendoltol.com/monograph/">buy etodolac without a prescription</a> carbamazepine price
Agqcyp
brand neurontin - <a href="https://aneutrin.com/sulfasalazine/">order sulfasalazine 500 mg sale</a> azulfidine cheap
Ioqwho
buy colospa 135 mg sale - <a href="https://coloxia.com/etoricoxib/">buy etoricoxib cheap</a> buy cilostazol 100mg sale
Ehlabv
order generic celebrex 200mg - <a href="https://celespas.com/indomethacin/">indomethacin generic</a> indocin ca
Lopamw
order rumalaya - <a href="https://rumaxtol.com/">rumalaya online</a> buy endep 50mg sale
Zfrjso
buy diclofenac 50mg sale - <a href="https://dicloltarin.com/aspirin/">aspirin 75mg uk</a> aspirin 75 mg oral
Rvickl
order mestinon - <a href="https://mestonsx.com/">where can i buy pyridostigmine</a> buy imuran cheap
Cbjnfe
oral voveran - <a href="https://vovetosa.com/animodipine/">cheap nimotop pill</a> nimodipine over the counter
Qyupox
buy meloxicam pills - <a href="https://meloxiptan.com/asrizatriptan/">purchase maxalt sale</a> buy ketorolac generic
Tjbtll
buy cyproheptadine 4 mg online - <a href="https://periheptadn.com/">periactin price</a> buy cheap generic zanaflex
Vnxfte
buy artane pills for sale - <a href="https://voltapll.com/diclofenacgel/">order diclofenac gel online</a> purchase voltaren gel sale
Erkldc
buy cheap generic isotretinoin - <a href="https://aisotane.com/">isotretinoin brand</a> deltasone 20mg pill
Fyqjjx
buy cefdinir generic - <a href="https://omnixcin.com/aminocycline/"></a> where to buy cleocin without a prescription
Kwxelo
buy permethrin generic - <a href="https://actizacs.com/tretinoin/">tretinoin gel cheap</a> buy generic tretinoin cream
Hnqgmk
prednisone 20mg us - <a href="https://apreplson.com/permethrin/">buy permethrin generic</a> elimite creams
Tjlyaa
flagyl generic - <a href="https://ametronles.com/">flagyl 200mg without prescription</a> buy cenforce generic
Oredui
betamethasone 20 gm ca - <a href="https://betnoson.com/awdifferin/">brand differin</a> order generic monobenzone
Rsyjvf
augmentin 625mg cost - <a href="https://alevonted.com/">synthroid 100mcg drug</a> order synthroid 150mcg generic
Zxiesb
how to get clindamycin without a prescription - <a href="https://clinycinpl.com/">order cleocin 300mg online</a> oral indomethacin 75mg
Vhqxpm
order crotamiton for sale - <a href="https://aeuracream.com/">buy eurax cream for sale</a> purchase aczone gel
Zuoxsh
buy losartan 50mg for sale - <a href="https://cozartan.com/">order losartan 25mg sale</a> order cephalexin pills
Tusnvi
buy bupropion 150mg sale - <a href="https://bupropsl.com/orlistat/">buy orlistat 120mg pills</a> buy shuddha guggulu without a prescription
Uiqwyr
buy generic modafinil over the counter - <a href="https://sleepagil.com/">modafinil 200mg canada</a> melatonin 3mg drug
Zvmwvq
brand prometrium - <a href="https://apromid.com/gynelotrimin/">buy generic ponstel</a> clomiphene online buy
Sjjffn
buy generic xeloda for sale - <a href="https://xelocap.com/">buy capecitabine 500 mg without prescription</a> danocrine without prescription
Abthnd
buy generic norethindrone - <a href="https://norethgep.com/bimatoprost/">careprost spray</a> buy yasmin pill
Aipuwx
alendronate for sale - <a href="https://pilaxmax.com/tamoxifen/">buy tamoxifen cheap</a> buy provera 10mg
Jmznwf
dostinex cost - <a href="https://adostilin.com/cabgolin/">cabgolin cheap</a> purchase alesse for sale
Mnmuuc
order estrace 1mg pills - <a href="https://festrolp.com/letrozole/">cheap letrozole 2.5mg</a> order anastrozole 1mg online
Oiszwk
バイアグラ 副作用 - <a href="https://jpedpharm.com/">バイアグラ 個人輸入 おすすめ</a> シアリス通販おすすめ
Cxqcri
プレドニン通販で買えますか - <a href="https://jpaonlinep.com/jamoxicillin/">アモキシシリン - 500mg</a> アジスロマイシン は通販での購
Cyvjsh
eriacta stamp - <a href="https://eriagra.com/szenegrag/">zenegra ahead</a> forzest punish
Ajrima
プレドニン処方 - <a href="https://jpanfarap.com/">プレドニン の購入</a> アキュテイン おすすめ