V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX  ›  XIVN1987  ›  全部回复第 14 页 / 共 42 页
回复总数  824
1 ... 10  11  12  13  14  15  16  17  18  19 ... 42  
2021 年 1 月 14 日
回复了 mascteen 创建的主题 知乎 Intel 正在死去,大家怎么看呢?
M1 才出第一代产品,RISC-V 也就才露个头而已,,喊 Intel 死去是不是太早了点儿
2021 年 1 月 14 日
回复了 KnightNic 创建的主题 Python 求教 Python enumerate 问题
@Latin

enumerate 还能设索引起始值,,以前没注意过,,学到一手
2021 年 1 月 12 日
回复了 crazjieb 创建的主题 PHP PHP 程序员们, 团结起来, 我们去学点新东西吧
虽然我不用 PHP,,不过说 golang 取代 php 我不赞同,,

一个是静态语言、一个是动态语言,,二者分别适用于不同的场景,,适合 PHP 的场景用 go 虽然也能做,,但肯定会繁琐很多

同理,看到有人试图用 go 写 shell 脚本、替代 python 搞 pandas 数据分析,,我觉得这都是把 go 用到了不合适的场景
2021 年 1 月 12 日
回复了 junwind 创建的主题 程序员 大家平时都使用什么工具做笔记呢
为知笔记 +1
2021 年 1 月 7 日
回复了 secsilm 创建的主题 C++ C++ IDE/editor 推荐
楼上好多推荐 Clion 的,,可是 Clion 并没有社区版啊

我觉得个人业余偶尔写几行 C++买个 License 不值得;用盗版的话满世界找破解、破解工具还有可能带病毒,也不值得

所以如果是公司开发商业软件的话,买 Clion 挺好,,但个人学习用还是找个免费版的 IDE 比较好
2021 年 1 月 7 日
回复了 AzureDeer 创建的主题 Python 请问大家,我这一段为啥报错呀
sum_score 不能用全局变量吧,难道你每次调用 get_average()都要累计之前的分数?
那你计算平均分的时候只除以本次调用的科目数,,平均分岂不是越来越高、单调递增了~~~^_^~~~
2021 年 1 月 7 日
回复了 unknowfly 创建的主题 Python 请教一个关于类和实例使用的疑问
我觉得第一种用法和第二种用法的主要区别是:第二种用法强制调用__init__方法,这样类的设计者可以在__init__中做各种初始化和环境检查
2021 年 1 月 5 日
回复了 zxCoder 创建的主题 C 大家写 C 语言除了搞硬件的,还有做什么工作的啊
Gtk 用的 C,,跨平台的 GUI
2021 年 1 月 4 日
回复了 RingSunKaiya 创建的主题 Python Python 中如何直接 import 某个 dll
@dinjufen

说到 boost::python,,那不如试试它的一个轻量级复制品,,

pybind11 is a lightweight header-only library that exposes C++ types in Python and vice versa, mainly to create Python bindings of existing C++ code. Its goals and syntax are similar to the excellent Boost.Python library by David Abrahams: to minimize boilerplate code in traditional extension modules by inferring type information using compile-time introspection.

header-only,没有依赖、简化配置、更易使用,,下面这个帖子里有我的编译方法,可以看到非常简单:

https://www.v2ex.com/t/740805
2021 年 1 月 4 日
回复了 RingSunKaiya 创建的主题 Python Python 中如何直接 import 某个 dll
虽然后缀名是 dll,,但文件内容可能是 pyd,,

毕竟后缀名可以随便改,,不能仅凭后缀名就断定文件内容
虽然在 jupyter notebook 中没有显示“Hello 16 2.30”,但在 jupyter.exe 终端中有显示,,能够验证代码的执行效果,,所以这个问题不算很严重
找到一篇文章,上面说出现这种问题的原因是:
IPython forwards the Python-level sys.stdout and sys.stderr, but it leaves the process-level file descriptors that C code will write to untouched. That means that in a context like this notebook, these functions will print to the terminal, because they are not captured.

文章链接: https://notebook.community/minrk/wurlitzer/Demo
2020 年 12 月 30 日
回复了 XIVN1987 创建的主题 Jupyter jupyter 转 markdown 要是能内嵌图片就好了
写了脚本,自动将 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)

```
2020 年 12 月 30 日
回复了 XIVN1987 创建的主题 Jupyter jupyter 转 markdown 要是能内嵌图片就好了
2020 年 12 月 30 日
回复了 XIVN1987 创建的主题 Jupyter jupyter 转 markdown 要是能内嵌图片就好了
@neosfung
感谢,,试了下确实支持

之前测试不工作,原来是 jupyter 导出的时候多了两个换行,,为知笔记就不认了,,把换行去掉就可以了

jupyter 导出的是

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

改成

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

就可以了,,
2020 年 12 月 30 日
回复了 XIVN1987 创建的主题 Jupyter jupyter 转 markdown 要是能内嵌图片就好了
@neosfung
确实,html 输出中通过<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUg...">语法内嵌了图片

查了下这个语法叫 Data URI scheme,,希望 markdown 也能支持这种用法,,这样笔记会方便很多

感谢指点
js 这个 import .. from ... 很魔性啊,自动补全怎么工作?

是不是先打 form ...,然后在回到行首打 import 啊?
@abersheeran
前者是 pos-only
后者是 kw-only
2020 年 12 月 26 日
回复了 taogen 创建的主题 Linux 2021 年 Linux 发行版推荐?
deepin,界面比较美观
1 ... 10  11  12  13  14  15  16  17  18  19 ... 42  
关于   ·   帮助文档   ·   自助推广系统   ·   博客   ·   API   ·   FAQ   ·   Solana   ·   2453 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 39ms · UTC 12:30 · PVG 20:30 · LAX 04:30 · JFK 07:30
♥ Do have faith in what you're doing.