上一页 1 2 3 4 5 6 ··· 8 下一页
摘要: #打印字符串中,指定的字符出现的次数 str="56rtyrtyrtertert"s="t"print(str.count(s)) 阅读全文
posted @ 2024-02-20 11:17 琳达的博客 阅读(15) 评论(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 琳达的博客 阅读(4) 评论(0) 推荐(0) 编辑
摘要: #打印除当前日期时间import datetimeprint(datetime.datetime.now()) 阅读全文
posted @ 2024-02-19 17:58 琳达的博客 阅读(2) 评论(0) 推荐(0) 编辑
摘要: #打印1-100随机10个整数import randomfor i in range(3): a=random.randint(1,101) print(a) 阅读全文
posted @ 2024-02-19 17:37 琳达的博客 阅读(67) 评论(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 琳达的博客 阅读(4) 评论(0) 推荐(0) 编辑
摘要: 1:在python相关路径内创建个文件 2:read读取即可 with open("sunlin.txt")as f: content=f.read() print(content) 阅读全文
posted @ 2024-02-19 16:11 琳达的博客 阅读(5) 评论(0) 推荐(0) 编辑
摘要: for i in range(0,5): print("*"*(i+1)) 阅读全文
posted @ 2024-02-19 14:46 琳达的博客 阅读(75) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2024-02-19 14:37 琳达的博客 阅读(7) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2024-02-19 10:58 琳达的博客 阅读(11) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 ··· 8 下一页