常用工具类方法集合
Project description
This is my common Python tool classes.
/data/apps/public/conf.ini content like:
[mysql]
host=example.com
port=3306
user=username
passwd=password
database=test
charset=utf8mb4
Find the localhost internal network ip:
from wcommon import *
ip = getLocalIp()
hostname = getLocalHostname()
Decode unusual json string:
from wcommon import *
line = """
{
name:'java',
system:'linux'
}
"""
result = dejson(line)
# output result
{"name":"java","system":"linux"}
Operate mysql data:
mysql = Mysql(configuraion_file="/data/apps/public/conf.ini", section="mysql")
#query
rows = mysql.query("select * from example_table where status = %s order by id desc limit %s",(1,10))
for row in rows:
print(row)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
wcommon-1.2.0.tar.gz
(6.3 kB
view details)
File details
Details for the file wcommon-1.2.0.tar.gz.
File metadata
- Download URL: wcommon-1.2.0.tar.gz
- Upload date:
- Size: 6.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.26.0 requests-toolbelt/0.9.1 urllib3/1.26.7 tqdm/4.62.3 importlib-metadata/4.8.1 keyring/23.1.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
815239e84d3ec8ed95583995dd9145ac7623e9369013ec5e9e5030ca90e5e716
|
|
| MD5 |
3452927f52fe6c8cbb471ee882b10d1f
|
|
| BLAKE2b-256 |
4fa84cbc2e8a0b4e724f819b81e2de25433dfd513ade7beb9018d7f70c2cc814
|