python
尤大神的小粉丝
喜欢把自己所学到的知识分享给大家,主要学的是前端和Python,Java,数据结构
展开
-
jieba库
jieba库安装pip install jieba我安装时出现了这个警告:You should consider upgrading via the ‘pip install --upgrade pip’ command.说明pip版本较低,需要升级敲入python -m pip install --upgrade pip即可解决。使用函数描述jieba.cut(s)精确模式,返回一个可迭代的数据类型jieba.cut(s,cut_all=True)全模原创 2021-03-19 11:10:03 · 656 阅读 · 0 评论 -
sql语句在python中的写法
sql = "select sum(confirm)," \ "(select suspect from history order by ds desc limit 1)," \ "sum(heal)," \ "sum(dead) " \ "from details " \ "where update_time=(select update_time from details order by updat.原创 2021-03-17 11:13:26 · 2522 阅读 · 0 评论 -
if...else...简化
s = eval(input("请输入"))t = "*" if s%3 == 0 and s%5 == 0 else "不"print("{}这个数字".format(t))等价于s = eval(input("请输入"))t = "*"if s%3 == 0 and s%5 == 0 : print("{}这个数字".format(t))else : "不"原创 2021-03-15 21:26:50 · 98 阅读 · 0 评论 -
Python切片
Python切片切片的语法[起始:结束:步长][起始:结束](步长=1)[:结束](起始=0)[起始:](起始到结束)[索引]a =['x','y','z','d','e','f','g']print(a[0:3:1]) #['x', 'y', 'z']print(a[0:5:2]) #['x', 'z', 'e']print(a[-1::-1]) #['g', 'f', 'e', 'd', 'z', 'y', 'x']print(a[0:6]原创 2021-03-10 12:20:50 · 118 阅读 · 0 评论 -
python第二套45题
python第二套45题第一种:names=input("请输入各个同学行业名称,行业名称之间用空格间隔(回车结束输入):")t = names.split()d = {}for i in t: d[i]=d.get(i,0)+1ls = list(d.items())ls.sort(key=lambda x:x[1], reverse=True) # 按照数量排序for k in ls: print("{}:{}".format(k[0],k[1]))第二种:name原创 2021-03-07 09:52:57 · 645 阅读 · 0 评论 -
针对turtle.setheading()与turtle.right(),turtle.left()的讨论:
针对turtle.setheading()与turtle.right(),turtle.left()的讨论:以三角形为例:turtle.left()与turtle.right(), turtle.seth()原创 2021-02-06 11:07:36 · 5291 阅读 · 1 评论