python
github_元宝
这个作者很懒,什么都没留下…
展开
-
测试数据生成
import matplotlib as mpl import numpy as np import sklearn import pandas as pd import os import sys import time import tensorflow as tf from tensorflow import keras print(tf.__version__) print(sys.version_info) for module in mpl, np, pd, sklearn, tf, ker原创 2021-05-08 15:59:49 · 144 阅读 · 0 评论 -
python-list处理例子
a = [(1,2), (3, 4), (5, 6)] c, d = zip(*a) print(c, d) (1, 3, 5) (2, 4, 6)原创 2021-05-08 14:52:26 · 74 阅读 · 0 评论 -
unicodedata 字符处理例子
>>> import unicodedata >>> import sys >>> cmb_chrs = dict.fromkeys(c for c in range(sys.maxunicode) ... if unicodedata.combining(chr(c))) ... >>> b = unicodedata.normalize('NFD', a) >>> b原创 2021-05-08 14:51:05 · 358 阅读 · 0 评论 -
numpy相关
np.random.randint(2, size=10) array([1, 0, 0, 0, 1, 1, 0, 0, 1, 0]) # random np.random.randint(1, size=10) array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0]) numpy.random.randint¶原创 2021-05-07 14:27:47 · 71 阅读 · 0 评论 -
python format 用法及使用
不设置指定位置,按默认顺序 设置指定位置 字典设置参数 列表索引设置参数 传入对象 str.format() 格式化数字 >>>"{} {}".format("hello", "world") # 不设置指定位置,按默认顺序 'hello world' >>> "{0} {1}".format("hello", "world") # 设置指定位置 'hello world' >>> "{1} {0} {1}".format("hell.原创 2021-04-04 10:20:11 · 81 阅读 · 0 评论