02 2024 档案

摘要:#打印最新时间(格式化时间) 阅读全文
posted @ 2024-02-27 18:04 琳达的博客 阅读(4) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2024-02-27 14:40 琳达的博客 阅读(5) 评论(0) 推荐(0) 编辑
摘要:python# 假设向程序提供了以下输入:8 然后输出应为:40320 阅读全文
posted @ 2024-02-23 18:03 琳达的博客 阅读(9) 评论(0) 推荐(0) 编辑
摘要:#编写一个程序,查找所有此类数字,它们可以被7整除,但不能是5的倍数(在2000和3200之间(均包括在内))。# 获得的数字应以逗号分隔的顺序打印在一行上。s=[]for i in range(2000,3201): if(i %7==0) and (i%5!=0): s.append(i)pri 阅读全文
posted @ 2024-02-21 14:35 琳达的博客 阅读(152) 评论(0) 推荐(0) 编辑
摘要:# 将字符串 a = “ welcome to my world ”首尾空格去掉a=" welcome to my world "print(a.strip()) 阅读全文
posted @ 2024-02-20 18:19 琳达的博客 阅读(118) 评论(0) 推荐(0) 编辑
摘要:# 输入一个姓名,判断是否姓王。name=input("请输入姓名")if name[0] =="王": print("姓王")else: print("不姓王") 阅读全文
posted @ 2024-02-20 17:05 琳达的博客 阅读(366) 评论(0) 推荐(0) 编辑
摘要:#判断字符串 a = “welcome to my world” 是否包含单词 b = “world”,包含返回 True,不包含返回 Falsedef test(): a = "welcome to my world" b="world" if b in a: return True else: 阅读全文
posted @ 2024-02-20 16:52 琳达的博客 阅读(119) 评论(0) 推荐(0) 编辑
摘要:#打印字符串中,指定的字符出现的次数 str="56rtyrtyrtertert"s="t"print(str.count(s)) 阅读全文
posted @ 2024-02-20 11:17 琳达的博客 阅读(33) 评论(0) 推荐(0) 编辑
摘要:#找出单词 “linda” 在字符串“welcome to my world,linda.” 中出现的位置,找不到返回 -1。#def test(): str = "welcome to my world,linda" a = "linda" if a in str: return str.find 阅读全文
posted @ 2024-02-20 11:13 琳达的博客 阅读(10) 评论(0) 推荐(0) 编辑
摘要:#打印除当前日期时间import datetimeprint(datetime.datetime.now()) 阅读全文
posted @ 2024-02-19 17:58 琳达的博客 阅读(5) 评论(0) 推荐(0) 编辑
摘要:#打印1-100随机10个整数import randomfor i in range(3): a=random.randint(1,101) print(a) 阅读全文
posted @ 2024-02-19 17:37 琳达的博客 阅读(353) 评论(0) 推荐(0) 编辑
摘要:#将文件1的内容-复制到文件2with open("sunlin.txt","r")as f1: with open("linda.txt","w")as f2: content=f1.read() f2.write(content) 阅读全文
posted @ 2024-02-19 16:48 琳达的博客 阅读(29) 评论(0) 推荐(0) 编辑
摘要:1:在python相关路径内创建个文件 2:read读取即可 with open("sunlin.txt")as f: content=f.read() print(content) 阅读全文
posted @ 2024-02-19 16:11 琳达的博客 阅读(10) 评论(0) 推荐(0) 编辑
摘要:for i in range(0,5): print("*"*(i+1)) 阅读全文
posted @ 2024-02-19 14:46 琳达的博客 阅读(159) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2024-02-19 14:37 琳达的博客 阅读(21) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2024-02-19 10:58 琳达的博客 阅读(24) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2024-02-18 10:44 琳达的博客 阅读(73) 评论(0) 推荐(0) 编辑
摘要:count()函数即可解决a="xrctvgybxrcftvgybcvtgybhcrvtrfgbcv"print(a.count("x")) 阅读全文
posted @ 2024-02-18 10:15 琳达的博客 阅读(7) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示