It does what it says it does.
Project description
# doc2md
本意是为了
像
---
``` py
倒序
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 格式
``` py
# 倒序
for color in sorted(colors, reverse=True):
print colors
```
自定义排序顺序
``` py
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)
```
更好的方法
``` py
print sorted(colors, key=len)
```
第一种方法效率低而且写起来很不爽。另外,Python 3已经不支持比较函数了。
调用一个函数直到遇到标记值
``` py
blocks = []
while True:
block = f.read(32)
if block == '':
break
blocks.append(block)
```
---
## 运行文件是 ``main/doc2md.py``
一步一步过程 可以使用``jupyter notebook`` 查看 ``doc2md.ipynb``
首先说明缺陷就是,命令行还没有做
请自己进入文件修改先。
``` py
Path = "../让你的Python优雅.md"
write_file = '../test_w.md'
```
## demo 就是
``` py
python doc2md.py file1
```
> 获取 ``让你的Python优雅.md``
> md格式``写``入 ``test_w.md``
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
doc2md2-0.1.1.tar.gz
(4.5 kB
view hashes)
Built Distribution
Close
Hashes for doc2md2-0.1.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cf09498d44d12dec84b4e458ccb03bc69fe3d4a44b75217f33f32f0d2f1531f1 |
|
MD5 | d5401eeead084e9775f7a9e2e64794e1 |
|
BLAKE2b-256 | 02e967a3d42f0d2691cadd9914d40f3f941a4e24f111180d6ecfacd953c6adac |