python学习
文章平均质量分 79
爱吃橘子-
这个作者很懒,什么都没留下…
展开
-
Pygcn源码解读
import numpy as np import scipy.sparse as sp import torch def encode_onehot(labels): classes=set(labels) #求出labels的类 classes_dict={c:np.identity(len(classes))[i,:] for i,c in enumerate(classes)} #生成类别字典 labels_onehot=np.array(list(map(c.原创 2021-10-30 18:47:53 · 1838 阅读 · 1 评论 -
Python入门(下)--函数
一、定义 return[表达式]结束函数,不带表达式的return相当于返回None. def functionname(para): "函数文档字符串" functionsuite return[expression] 二、函数的调用 def printme(str): print(str) temp=printme('hello') #hello print(temp) #None 三、函数文档 四、函数参数 1.位置参数 arg1-..原创 2021-10-05 10:26:55 · 158 阅读 · 0 评论 -
Python入门之运算符与数据类型
运算符 分类 1.算术运算符 / 除 3/4=0.75 // 整除 3//4=0 ** 幂 3**4=12 2.比较运算符 同C语言 3.逻辑运算符 and 与 or 或 not 非 4.位运算符 & 按位与 | 按位或 ^ 按位异或 ~ 按位非 << 左移 >> 右移 异或运算:不同取1 5.三元运算符 x, y =原创 2021-09-30 11:03:15 · 77 阅读 · 0 评论