Skip to main content

一些简单的工具方法

Project description

dastyletools

使用dastyletools

pip install dastyletools
from dastyletools import tools

# 加
tools.add(1, 1)  # 2
# 减
tools.sub(1, 1)  # 0
# 乘
tools.mul(1, 1)  # 1
# 除
tools.div(1, 1)  # 1.0

# 从列表1的n坐标处拼接列表2
a = [i for i in range(10)]  # [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
b = [i for i in range(5, 15)]  # [5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
c = tools.rl1n_to_l2(a, b, 3)  # [0, 1, 2, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]

# 返回拉平的多维数组
a = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
tools.flatten_list(a)  # [1, 2, 3, 4, 5, 6, 7, 8, 9]

# 从源数组的值中随机分配出不重复的包含源数组值n个数组
a = [i for i in range(10)]
tools.random_list_n(a, 5) # [[6, 9], [1], [5, 0, 7], [2], [4, 3, 8]]

# 生产从0到n的数组
tools.arange(10) # [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]

打包python模块

安装必要的模块

pip install setuptools
pip install wheel
pip3 install twine

创建~/.pypirc文件并且进行一些配置

pypi注册你的账号

[distutils]
index-servers = pypi

[pypi]
username:xxx
password:xxx
# 生成gz压缩包跟wheel文件,可以直接用pip install安装
python setup.py sdist bdist_wheel       
# 直接源码编译与安装    
python setup.py build install           

上传源码到pypi

twine upload dist/*.whl

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dastyletools-0.0.4-py3-none-any.whl (3.0 kB view details)

Uploaded Python 3

File details

Details for the file dastyletools-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: dastyletools-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 3.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.6

File hashes

Hashes for dastyletools-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 83a2c39a86fd274d024b326afd463ae72304e3d36f23e2683178433f9ba42ddf
MD5 d08db11d2068e7f6f705495f71a0df0a
BLAKE2b-256 6b0f250c76227f7597d5ead8ae86f92542d23fab7cc9ad57917e119a00fbcd5d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page