摘要:
symbols = '$%^&*♕' codes = [] # 创建一个codes列表 for symbol in symbols: # 用for循环迭代symbols codes.append(ord(symbol)) # 将symbols中的元素迭代取出后转化为Unicode码并添加到列表中 c 阅读全文
摘要:
import torch from torchvision import transforms from torchvision import datasets from torch.utils.data import DataLoader import torch.nn.functional as 阅读全文
摘要:
利用特殊方法,来使得自定义对象来实现一个二维向量(Vector)类 一个简单的二维向量类 from math import hypot class Vector: def __init__(self, x=0, y=0): self.x = x # 将输入的x,y分别赋值给类属性x,y self.y 阅读全文