![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
python
淅雨听风
努力不一定成功,但是不努力一定不成功!
展开
-
python模拟银行自助取款
# 卡号 card1="1001" pwd1="123456" ban1=10000 card2="1002" pwd2="123456" ban2=10000 card3="1003" pwd3="123456" ban3=10000 print("欢迎来到python银行!") times=0 while True: card=input("请输入银行卡号!") pwd=input("请输入密码:") ban=0 # 余额 if card==card1 and pwd==p.原创 2020-10-09 20:24:23 · 1488 阅读 · 1 评论 -
python模块调用
import random #生成随机数 # from hanshu import f1 #引入模块的方法 # print(f1("hello,")) import hanshu print(hanshu.f1("你好,f1")) a=random.random() b=random.choice(["光子","张璐","王五","李柳","李莉","李老师"]) print(a) print(b) ...原创 2020-10-09 20:18:17 · 273 阅读 · 0 评论 -
python编码转换
# encode() decode() # ascil # gb2312 gbk # unicode # utf-8 # python3中字符串的两种类型:byte,str,str存储Unicode类型,bytes存储byte类型 # 字符串(Unicode) 转换byte----编码 a="北京的金山上太阳照四方!" b=a.encode("utf-8") #转成字节码 print(b) #byte转字符串(Unicode)----解码 编码和解码的方式必须一致:"utf-8" c=b.decode.原创 2020-10-09 20:14:15 · 172 阅读 · 0 评论 -
python线程执行
import threading import time dog_basin = threading.BoundedSemaphore(2) #dog_basin 代表狗盆 def eat(name,delay,food): for i in range(5): print("{}吃了{}个{}\t".format(name,i+1,food)) time.sleep(delay) class Mythread(threading.Thread): def...原创 2020-10-09 19:56:01 · 156 阅读 · 0 评论