Skip to main content

doc2md

本意是为了

像


倒序
for color in sorted(colors, reverse=True):
    print colors

自定义排序顺序

colors = ['red', 'green', 'blue', 'yellow']

def compare_length(c1, c2):
    if len(c1) < len(c2): return -1
    if len(c1) > len(c2): return 1
    return 0

print sorted(colors, cmp=compare_length)

更好的方法

print sorted(colors, key=len)

第一种方法效率低而且写起来很不爽。另外,Python 3已经不支持比较函数了。

调用一个函数直到遇到标记值

blocks = []
while True:
    block = f.read(32)
    if block == '':
        break
    blocks.append(block)

变成 下面 markdown 格式

# 倒序
for color in sorted(colors, reverse=True):
    print colors

自定义排序顺序

colors = ['red', 'green', 'blue', 'yellow']

def compare_length(c1, c2):
    if len(c1) < len(c2): return -1
    if len(c1) > len(c2): return 1
    return 0

print sorted(colors, cmp=compare_length)

更好的方法

print sorted(colors, key=len)

第一种方法效率低而且写起来很不爽。另外,Python 3已经不支持比较函数了。

调用一个函数直到遇到标记值

blocks = []
while True:
    block = f.read(32)
    if block == '':
        break
    blocks.append(block)

运行文件是 main/doc2md.py

一步一步过程 可以使用jupyter notebook 查看 doc2md.ipynb

首先说明缺陷就是,命令行还没有做 请自己进入文件修改先。

Path = "../让你的Python优雅.md"
write_file = '../test_w.md'

demo 就是

useag:
$ doc2md2 file1 file2
    file2.md is create markdown from file1.md

$ doc2md2 file1
    file1.md is create markdown from file1


获取 ``让你的Python优雅.md``

md格式\ ``写``\ 入 ``test_w.md``

Metadata

Release files for doc2md2 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for doc2md2 0.1.3
File Size Uploaded Provenance Actions
doc2md2-0.1.3.tar.gz 4.5 kB Without provenance Details for doc2md2-0.1.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for doc2md2 0.1.3
File Interpreter ABI Platform Actions
doc2md2-0.1.3-py2.py3-none-any.whl Python 2, Python 3 none any Details for doc2md2-0.1.3-py2.py3-none-any.whl

Total release size: 10.1 kB

Release files / doc2md2-0.1.3.tar.gz

Download URL doc2md2-0.1.3.tar.gz
Size 4.5 kB
Tags Source
SHA-256 checksum
How to use checksums
8f0487a419dce8b80c4d50bffa0e71a39d4856b51b7677eb55f1bacafd75f6b2
BLAKE2b-256 checksum
How to use checksums
2f2f31b75675e0386ef1cc38a861e02f73a83488d4abab8e89448c618aff1044
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / doc2md2-0.1.3-py2.py3-none-any.whl

Download URL doc2md2-0.1.3-py2.py3-none-any.whl
Size 5.6 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
ed56360cdfe3cecf5ea599c4cb8c575adf84207212b77c7346537c50f00fe665
BLAKE2b-256 checksum
How to use checksums
a4853cc57812a6243df7e23705fe6f97576aabff89315d74129b8106fb2df3af
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for doc2md2 0.1.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page