python-reformat
Project description
格式化正则内容输出
===============
$0、$1、$2 分别对应 match中的g0、g1、g2、g3
multi是否为多重匹配,是则返回所有结果,否则返回首匹配
>>> data = '12m34kjdg8946o'
>>> pn = '(\d)([a-z])'
>>> fm = '$1,$2'
>>> result = extract(pn, data, fm)
>>> result
'2,m'
>>> result = extract(pn, data, fm, multi= True)
>>> result
['2,m', '4,k', '6,o']
===============
$0、$1、$2 分别对应 match中的g0、g1、g2、g3
multi是否为多重匹配,是则返回所有结果,否则返回首匹配
>>> data = '12m34kjdg8946o'
>>> pn = '(\d)([a-z])'
>>> fm = '$1,$2'
>>> result = extract(pn, data, fm)
>>> result
'2,m'
>>> result = extract(pn, data, fm, multi= True)
>>> result
['2,m', '4,k', '6,o']
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
python-reformat-0.1.tar.gz
(2.1 kB
view details)
File details
Details for the file python-reformat-0.1.tar.gz
.
File metadata
- Download URL: python-reformat-0.1.tar.gz
- Upload date:
- Size: 2.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6867d72369c32c7aa684ea05e7827d902c470116b4a5c214a94c606c39caba36 |
|
MD5 | 43005aee849abbde8e9e9eb785296e15 |
|
BLAKE2b-256 | 84c61ed9b8fd29bb5889850fec73f8203677a32add2569b69fd5b442d618e95d |