惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

SecWiki News
SecWiki News
Microsoft Azure Blog
Microsoft Azure Blog
V2EX - 技术
V2EX - 技术
N
News and Events Feed by Topic
Webroot Blog
Webroot Blog
博客园_首页
月光博客
月光博客
N
News | PayPal Newsroom
The Cloudflare Blog
博客园 - 聂微东
酷 壳 – CoolShell
酷 壳 – CoolShell
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
量子位
G
Google Developers Blog
T
Troy Hunt's Blog
博客园 - Franky
腾讯CDC
S
Security Affairs
J
Java Code Geeks
aimingoo的专栏
aimingoo的专栏
S
Security @ Cisco Blogs
www.infosecurity-magazine.com
www.infosecurity-magazine.com
The Last Watchdog
The Last Watchdog
B
Blog RSS Feed
D
DataBreaches.Net
Recorded Future
Recorded Future
H
Heimdal Security Blog
V
Vulnerabilities – Threatpost
Apple Machine Learning Research
Apple Machine Learning Research
云风的 BLOG
云风的 BLOG
博客园 - 司徒正美
D
Docker
P
Proofpoint News Feed
V
V2EX
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
S
Secure Thoughts
Engineering at Meta
Engineering at Meta
PCI Perspectives
PCI Perspectives
宝玉的分享
宝玉的分享
The Hacker News
The Hacker News
有赞技术团队
有赞技术团队
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Cloudbric
Cloudbric
Microsoft Security Blog
Microsoft Security Blog
G
GRAHAM CLULEY
MyScale Blog
MyScale Blog
L
LINUX DO - 热门话题
雷峰网
雷峰网
Know Your Adversary
Know Your Adversary

Jupyter

SSL 认证莫名其妙报错了,需要引起警惕吗? - V2EX 这是什么 jupyter 插件,感觉挺酷 - V2EX 现在人工智能专业这么火,大家 jupyter 常用的一些插件和功能是啥? - V2EX pycharm 的里的 jupyternotebook 能断点调试吗? - V2EX Jupyter Notebook 到底是用来干啥的? - V2EX pycharm 里连接远程 jupyter,自动补全怎么搞? - V2EX 单元格如何取消关联 - V2EX jupyter-notebook 内置环境变量问题 - V2EX Jupyter 里有什么插件 / Kernel 可以实现类似 ob-http 的功能 - V2EX 如何计算重复率统计? - V2EX 如何在内网环境从 Windows SSH 访问 Linux 服务器 - V2EX anaconda3 环境下,在 cmd 输入"jupyter lab"显示"Exception: Jupyter command `jupyter-lab` not found." - V2EX jupyter 中通过 ctypes 调用 printf()时,不显示 printf()打印内容 - V2EX jupyter-nbconvert.exe --generate-config 报错 UnicodeEncodeError: 'gbk' - V2EX JupyterLab 插件功能小贴士 - V2EX Jupyter 的输出窗口可以同时动态刷新两种图吗? - V2EX 最近整理了一些 Jupyter book 文档 - V2EX jupyter 怎么读 - V2EX 使用 Jupyter notebook 生成柱状图失败,问题出在哪?? - V2EX 求助, Jupyter 已经启动,但是网页无法显示 - V2EX 用 Jupyter 写非 Python 体验如何? - V2EX 写了一些 Jupyter notebook 的扩展插件 - V2EX Supervisor 无法停止 Jupyter Notebook - V2EX Jupyter 上的 Lua 与 torch7 - V2EX
jupyter 转 markdown 要是能内嵌图片就好了 - V2EX
XIVN1987 · 2020-12-30 · via Jupyter

写了脚本,自动将 jupyter 导出的 markdown 中的

```
![png](output_3_0.png)
```

替换成

```
<img src="data:image/png;base64,iVBO...">
```

代码如下:

``` python
#! python3
import os
import re
import binascii

srcfil = r'C:\Users\WMX\Desktop\pylab\pylab.md'

srcdir = os.path.dirname(srcfil)
dstfil = os.path.join(srcdir, os.path.basename(srcfil).replace('.md', '_emb.md'))

img_base64 = {}
for root, dirs, files in os.walk(srcdir):
for fname in files:
if fname.endswith('.png'):
img_data = open(os.path.join(root, fname), 'rb').read()
img_base64[fname] = f'<img src="data:image/png;base64,{binascii.b2a_base64(img_data, newline=False).decode("latin-1")}">'

content = open(srcfil, 'r', encoding='utf-8').read()
for img in img_base64:
content = re.sub(f'\n!\[png\]\({img}\)\n', f'\n{img_base64[img]}\n', content)

open(dstfil, 'w', encoding='utf-8').write(content)

```