04 2021 档案

摘要:"""多进程和多线程""" # 顺序执行 # from random import randint # from time import time, sleep # # # def download_task(filename): # print('开始下载%s...' % filename) # 阅读全文
posted @ 2021-04-30 18:31 菜鸡要加油 阅读(72) 评论(0) 推荐(0)
摘要:"""读写csv文件""" # 现有五个学生三门课程的考试成绩需要保存到一个CSV文件中,要达成这个目标, # 可以使用Python标准库中的csv模块,该模块的writer函数会返回一个csvwriter对象, # 通过该对象的writerow或writerows方法就可以将数据写入到CSV文件中 阅读全文
posted @ 2021-04-30 00:15 菜鸡要加油 阅读(294) 评论(0) 推荐(0)
摘要:from PIL import Image from PIL import ImageFilter image = Image.open(r"C:\Users\AD\Desktop\test.jpg") # 通过Image对象的format属性获得图像的格式 print(image.format) 阅读全文
posted @ 2021-04-28 01:28 菜鸡要加油 阅读(181) 评论(0) 推荐(0)
摘要:# 正则表达式的学习 import re # 拆分长字符串 poem = '窗前明月光,疑是地上霜。举头望明月,低头思故乡。' sentences_list = re.split(r'[,。, .]', poem) sentences_list = [sentence for sentence in 阅读全文
posted @ 2021-04-27 21:15 菜鸡要加油 阅读(96) 评论(0) 推荐(0)
摘要:import os print(os.path.dirname(r'C:\Users\AD\Desktop\temp1\大哥哥.wav')) # json模块有四个比较重要的函数,分别是: # # dump - 将Python对象按照JSON格式序列化到文件中 # dumps - 将Python对象 阅读全文
posted @ 2021-04-27 02:17 菜鸡要加油 阅读(153) 评论(0) 推荐(0)
摘要:# 若元组只有一个元素,要在后面加上',' def test_turple(): # 空元组 a = () print(type(a)) # <class 'tuple'> # 不是元组 b = ('hello') print(type(b)) # <class 'str'> c = (100) p 阅读全文
posted @ 2021-04-23 00:41 菜鸡要加油 阅读(53) 评论(0) 推荐(0)
摘要:import os import time # 在终端中显示跑马灯(滚动)文字。 def print_scroll(): content = '北 京 欢 迎 你 为 你 开 天 辟 地 ' while True: # Windows清除屏幕上的输出 os.system('cls') # macOS 阅读全文
posted @ 2021-04-23 00:09 菜鸡要加油 阅读(72) 评论(0) 推荐(0)