摘要: #Numpy import numpy as np a=np.array([[1,2,3],[2,3,4]])a.ndim #秩,即轴的数量或维度的数量a.shape #数组的维度,对于矩阵,n 行 m 列a.size #数组元素的总个数,相当于 .shape 中 n*m 的值a.dtype #数组 阅读全文
posted @ 2023-12-29 00:52 夕照~~ 阅读(47) 评论(0) 推荐(0)
摘要: import pygame import sys import random # 素材参考地址:https://www.aigei.com/s?q=flappy+bird&type=2d class Bird(object): """定义一个鸟类""" def __init__(self): """ 阅读全文
posted @ 2023-12-28 23:38 夕照~~ 阅读(56) 评论(0) 推荐(0)
摘要: ```import jieba # 读取文本文件path = "红楼梦.txt"file = open(path, "r", encoding="utf-8")text = file.read()file.close() # 使用jieba分词words = jieba.lcut(text) # 统 阅读全文
posted @ 2023-12-28 23:07 夕照~~ 阅读(38) 评论(0) 推荐(0)
摘要: #爬虫爬取Google20次 import requests url = 'https://www.google.com'for i in range(20): response = requests.get(url) print(f"第{i+1}次访问") print(f'Response sta 阅读全文
posted @ 2023-12-28 17:42 夕照~~ 阅读(33) 评论(0) 推荐(0)
摘要: #超市抹零price = 9.99 total = int(price) # 抹零操作 print(total) # 输出结果为9 #计算学生成绩的分差和平均分 scores = [85, 90, 92, 78, 80] avg_score = sum(scores) / len(scores) # 阅读全文
posted @ 2023-10-31 08:46 夕照~~ 阅读(25) 评论(0) 推荐(0)