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]]

打包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.3-py3-none-any.whl (2.9 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for dastyletools-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 33eed24b91fef67f530ce455ba88ad714d44ef1e58f0c078dbdc8778687224db
MD5 370b64a6941ad2a55925db55432b7d91
BLAKE2b-256 9618e64a75d5c3cb4d01bfc02f31f76df62b096732411551397cdeb1a736c369

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