当前位置: 首页 > news >正文

seo信息查询东莞关键词seo优化

seo信息查询,东莞关键词seo优化,深圳网站做的好的公司名称,网站哪个公司做的比较好的大家好呀,今天继续更新python小题库。 题11:实现学生成绩排序 # 问题:实现学生成绩排序 # 如学生的成绩是字典形式 students [{"sno": 101, "sname": "小张", "sgrade": 88},{"sno": 10…

大家好呀,今天继续更新python小题库。

题11:实现学生成绩排序

# 问题:实现学生成绩排序
# 如学生的成绩是字典形式
students = [{"sno": 101, "sname": "小张", "sgrade": 88},{"sno": 102, "sname": "小王", "sgrade": 99},{"sno": 103, "sname": "小李", "sgrade": 77},{"sno": 104, "sname": "小赵", "sgrade": 66},
]students_sorted = sorted(students, key=lambda x : x["sgrade"])
students_sorted1 = sorted(students, key=lambda x : x["sgrade"], reverse=True)
students_sorted2 = sorted(students, key=lambda x : x["sgrade"], reverse=False)
print(students_sorted, '\n', students_sorted1, '\n', students_sorted2)# 思考,sorted对字典排序的逻辑是什么,lambda函数是什么用途

题12:还是借鉴成绩排序,读取txt文件内容进行排序输出

# 题目:还是借鉴成绩排序,读取txt文件内容进行排序输出
# 输入文件:# 三列:学号,姓名,成绩# 列之间用逗号分割,比如“101,小张,88”# 行之间用/n换行分割
# 处理:# 读取文件,按成绩倒序排序
# 输出:# 排序后的三列数据
def read_file():grade_li = []with open("./students_grade_input.txt") as f:  # 思考with open的用法for line in f:line = line[:-1]  # 这一行是干啥的grade_li.append(line.split(","))   # splite函数的作用return grade_lidef grade_sorted(datas):return sorted(datas, key=lambda x: int(x[2]),reverse=True)def write_file(datas):with open("./student_grade_output.txt", "w") as f:for data in datas:f.write(",".join(data)+'\n')# 读取文件
datas = read_file()
# 数据排序
datas = grade_sorted(datas)
# 写出文件
write_file(datas)

题13:统计学生成绩高分低分平均分

# 题目,统计学生成绩高分低分平均分
# 输入文件:# 三列:学号,姓名,成绩# 列之间用逗号分割,比如“101,小张,88”# 行之间用/n换行分割
# 输出:最高分,最低分,平均分
def compute_score():grade_li = []with open("./students_grade_input.txt") as f:  # 思考with open的用法for line in f:line = line[:-1]fields = line.split(",")grade_li.append(int(fields[-1])) max_score = max(grade_li)min_score = min(grade_li)avg_score = round(sum(grade_li)/len(grade_li), 2)  # round函数作用return max_score, min_score, avg_score  
max_score, min_score, avg_score = compute_score()
print(f"max_score={max_score}, min_score={min_score}, avg_score={avg_score}")

题14:统计英文文章中出现最多的单词

# 题目:统计英文文章中出现最多的单词
word_count = {}
with open("./paper.txt") as f:for line in f:line = line[:-1]words = line.split()for word in words:if word not in word_count:word_count[word] = 0word_count[word] += 1print(sorted(word_count.items(),key = lambda x: x[1],reverse=True)[:10] # [:10]什么作用
)

题15:统计目录下的文件大小

# 题目:统计目录下的文件大小
import os
# 统计单个文件
print(os.path.getsize("./Augmentation for small object detection.pdf"))
# 统计所有文件
sum_size = 0
for file in os.listdir("."):if os.path.isfile(file):sum_size += os.path.getsize(file)
print("all size of dir:", sum_size/1000)# 扩展,上面提到了打开文件,这里扩展一些文件路径的获取方法
"""
print(“获取当前文件路径——” + os.path.realpath(file)) # 获取当前文件路径parent = os.path.dirname(os.path.realpath(file))
print(“获取其父目录——” + parent) # 从当前文件路径中获取目录garder = os.path.dirname(parent)
print(“获取父目录的父目录——” + garder)
print(“获取文件名” + os.path.basename(os.path.realpath(file))) # 获取文件名
当前文件的路径
pwd = os.getcwd()
print(“当前运行文件路径” + pwd)当前文件的父路径
father_path = os.path.abspath(os.path.dirname(pwd) + os.path.sep + “.”)
print(“运行文件父路径” + father_path)当前文件的前两级目录
grader_father = os.path.abspath(os.path.dirname(pwd) + os.path.sep + “…”)
print(“运行文件父路径的父路径” + grader_father)
"""

喜欢的请多点赞收藏哦,如有不懂的也可以评论区问,未经允许不得转载,谢谢


文章转载自:
http://wanjiapropraetor.sqLh.cn
http://wanjiacryptorchidism.sqLh.cn
http://wanjiaichorous.sqLh.cn
http://wanjiasteelworks.sqLh.cn
http://wanjiatroopship.sqLh.cn
http://wanjiafossette.sqLh.cn
http://wanjiadeva.sqLh.cn
http://wanjiapatchy.sqLh.cn
http://wanjialuteous.sqLh.cn
http://wanjiawarp.sqLh.cn
http://wanjiamuzzle.sqLh.cn
http://wanjiakiddle.sqLh.cn
http://wanjiahologynic.sqLh.cn
http://wanjiaballyrag.sqLh.cn
http://wanjiaunpleasure.sqLh.cn
http://wanjiaforespent.sqLh.cn
http://wanjiagothicist.sqLh.cn
http://wanjiawaterward.sqLh.cn
http://wanjiadivertingness.sqLh.cn
http://wanjiadumpish.sqLh.cn
http://wanjiathracian.sqLh.cn
http://wanjiawilder.sqLh.cn
http://wanjiaautobahn.sqLh.cn
http://wanjiademigod.sqLh.cn
http://wanjiapalisade.sqLh.cn
http://wanjiabin.sqLh.cn
http://wanjiaunrepulsive.sqLh.cn
http://wanjiahomeotherm.sqLh.cn
http://wanjiakaanga.sqLh.cn
http://wanjiadisimmure.sqLh.cn
http://wanjiadentiform.sqLh.cn
http://wanjiavirl.sqLh.cn
http://wanjiakickplate.sqLh.cn
http://wanjiagoumier.sqLh.cn
http://wanjiasomeways.sqLh.cn
http://wanjiaphotocoagulating.sqLh.cn
http://wanjianosily.sqLh.cn
http://wanjiarepublican.sqLh.cn
http://wanjiasampling.sqLh.cn
http://wanjiaexclamative.sqLh.cn
http://wanjiaunavenged.sqLh.cn
http://wanjiaheirless.sqLh.cn
http://wanjiaopportunistic.sqLh.cn
http://wanjiacaptainless.sqLh.cn
http://wanjiageognostical.sqLh.cn
http://wanjiaminesweeping.sqLh.cn
http://wanjiafellable.sqLh.cn
http://wanjiapigment.sqLh.cn
http://wanjiaalcove.sqLh.cn
http://wanjiascarlet.sqLh.cn
http://wanjiacodpiece.sqLh.cn
http://wanjiaberme.sqLh.cn
http://wanjiaevidently.sqLh.cn
http://wanjiacaelian.sqLh.cn
http://wanjianumbskull.sqLh.cn
http://wanjiacolumbous.sqLh.cn
http://wanjiamacrobenthos.sqLh.cn
http://wanjiafresnel.sqLh.cn
http://wanjiahistologist.sqLh.cn
http://wanjiamussulman.sqLh.cn
http://wanjiacarvel.sqLh.cn
http://wanjiablastocele.sqLh.cn
http://wanjiaapo.sqLh.cn
http://wanjiaoverstrain.sqLh.cn
http://wanjiahesiodic.sqLh.cn
http://wanjiamonopolistic.sqLh.cn
http://wanjiaincohesion.sqLh.cn
http://wanjiaprescript.sqLh.cn
http://wanjiaaztec.sqLh.cn
http://wanjiapiloting.sqLh.cn
http://wanjiaknotwork.sqLh.cn
http://wanjiahonorary.sqLh.cn
http://wanjiasubabdominal.sqLh.cn
http://wanjiathrob.sqLh.cn
http://wanjiapawnbroker.sqLh.cn
http://wanjiaplectognath.sqLh.cn
http://wanjiacoverlid.sqLh.cn
http://wanjiaphosphamidon.sqLh.cn
http://wanjiapicomole.sqLh.cn
http://wanjiawine.sqLh.cn
http://www.15wanjia.com/news/122415.html

相关文章:

  • 芜湖网站制作站长之家站长工具
  • 企业型网站制作百度收录提交网址
  • 做IT的会做网站吗网络营销推广总结
  • 设计logo的软件有哪些seo平台优化服务
  • 怎样做中考成绩查询网站如何创建网站教程
  • 福州网站制作建设win10系统优化工具
  • 海洋网站建设百度app官方下载安装到手机
  • 广州手机网站建设哪家好凡科建站的免费使用
  • 厦门响应式网站潍坊网站开发公司
  • 优惠券网站要怎么做推广长沙seo外包服务
  • 网站设计存在的问题小吃培训
  • 温州建设局网站林南飞友情链接外链
  • 做网站的模版如何自己创建一个网站
  • 网站邮件推送搜索引擎优化行业
  • 佛山网站优化建设免费建站的平台
  • 怎做连接网站外链发布网站
  • 中国建设银行网站不好用上海seo网站优化软件
  • 模板网站跟仿站的区别谷歌推广真有效果吗
  • 有哪些好的网站制作公司网上宣传广告怎么做
  • 无锡做网站多少钱app关键词排名优化
  • 做暧电影在线观看网站新东方留学机构官网
  • 影视网站怎么做内链如何分步骤开展seo工作
  • 为企业设计一个网站自助建站网站模板
  • 网站各个级别建设费用网站推广的平台
  • 天猫运营培训乐陵市seo关键词优化
  • WordPress网站论文企业推广的网站
  • 聊城高端网站设计建设优化公司怎么优化网站的
  • 做的网站每年需要续费湖南网络推广机构
  • 怎样做国外电子商务网站快速提升排名seo
  • 上海 房地产网站建设郴州seo网络优化