随笔分类 - python
摘要:9. 类 — Python 3.11.3 文档 https://docs.python.org/zh-cn/3/tutorial/classes.html class DerivedClassName(modname.BaseClassName): 派生类定义的执行过程与基类相同。 当构造类对象时,
阅读全文
摘要:merge two dicts Python 3.6.4 >>> x={'a':1,'b':2}>>> y={'b':3,'c':4}>>> z={**x,**y}>>> z{'a': 1, 'b': 3, 'c': 4}>>> z={**y,**x}>>> z{'b': 2, 'c': 4, 'a
阅读全文
摘要:https://bugs.python.org/issue2898 https://bugs.python.org/file10353/footprint.patch A new function, getsizeof(), takes a Python object and returns the
阅读全文
摘要:decorator Glossary — Python 3.6.3 documentation https://docs.python.org/3/glossary.html decorator A function returning another function, usually appli
阅读全文
摘要:原因:学python的时候,把centos7自带的python2.7改成了python3.6.2。而yum使用的是python2,所以会出现yum报错。 解决方法: 在文件/usr/bin/yum、/usr/libexec/urlgrabber-ext-down最上面的一行改为#!/usr/bin/
阅读全文
摘要:https://www.liaoxuefeng.com/wiki/
阅读全文
摘要:l=[1,2,3]def f(l): l[1]=123print(l)f(l)print(l)s="abc"def f1(s): s="x"print(s)f1(s)print(s) 可变对象 浅复制,函数修改了原值 不可变对象,不影响 对于不可变类型(数值型、字符串、元组),因变量不能修改,所以运
阅读全文
摘要:class Student():... name = 'Student'...s = Student() # 创建实例sprint(s.name) # 打印name属性,因为实例并没有name属性,所以会继续查找class的name属性Studentprint(Student.name) # 打印类
阅读全文
摘要:for i in range(3, -2, -1): try: print(4 / i) except Exception as e: print(Exception) print(e)
阅读全文
摘要:7.13. nonlocal 语句 nonlocal_stmt ::= "nonlocal" identifier ("," identifier)* nonlocal 语句会使得所列出的名称指向之前在最近的包含作用域中绑定的除全局变量以外的变量。 这种功能很重要,因为绑定的默认行为是先搜索局部命名
阅读全文
摘要:对于线性方程组Ax=b 对A和b执行同样的一串行初等运算, 那么该方程组的解集不发生变化。 【未知-已知 高阶--低阶】 http://mathworld.wolfram.com/CramersRule.html
阅读全文
摘要:Frequently Asked Questions — PyPy documentation https://doc.pypy.org/en/latest/faq.html#does-pypy-have-a-gil-why PEP 703 – Making the Global Interpret
阅读全文
摘要:every row of W is a classifier for one of the classes As we saw above, every row of W is a classifier for one of the classes. The geometric interpreta
阅读全文
摘要:安装TensorFlow 包依赖 https://www.tensorflow.org/tutorials/layers Building the CNN MNIST Classifier 【Each of these methods accepts a tensor as input and re
阅读全文
摘要:https://raw.githubusercontent.com/tensorflow/tensorflow/r1.3/tensorflow/examples/tutorials/word2vec/word2vec_basic.py
阅读全文
摘要:json.dumps(i['bd_res'], ensure_ascii=False) import xlrd import time import sys import os import requests import sqlite3 import threading import math import csv import pprint import json from openpy...
阅读全文
摘要:def gen_file_data(fodir, fname, sheet_index=0, ): if fname.find('.xlsx') > -1: fname_open = '%s\\%s' % (fodir, fname) book = xlrd.open_workbook(fname_open, on_demand=True...
阅读全文
摘要:time — Time access and conversions — Python 3.8.5 documentation https://docs.python.org/3/library/time.html#time.monotonic PEP 418 -- Add monotonic ti
阅读全文

浙公网安备 33010602011771号