lijin-thu / notes-python Goto Github PK
View Code? Open in Web Editor NEW中文 Python 笔记
中文 Python 笔记
02.05 使用0-base的使用
“Just to beautiful to ignore.
----Guido van Rossum”
Just to ==> Just too
大哥,感觉您这个真的不错,也知道您出版相应的中文书了。但是吧希望大哥您在百忙之中,更新一版吧,更新到Python3吧。
第393行的矩阵求解缺少换行,
但是我怎么捣鼓也不对hhhh,求大神指教,谢谢!
.\notes-python\generate_static_files.py in convert_to_files(names, to_format)
68 p = converter[to_format](file_name)
69 with open(os.path.join(target_dir, file_name[:-6] + p[1]["output_extension"]), 'w',encoding='utf8') as f:
---> 70 f.write(p[0].encode('utf8'))
71 print(file_name)
72
TypeError: write() argument must be str, not bytes
很明显,第70行有错误,f.write()只能写入字符串,应该改为f.write(p[0])
第二个错误是windows的问题,在windows下,默认的编码是cp936,也就是GBK,此时若不指定编码,python使用open()函数打开文件则默认为cp936,这显然是错误的,所以在使用open()打开文件时,应该指定编码,即
open(os.path.join(target_dir, file_name[:-6] + p[1]["output_extension"]), 'w', encoding='utf8') #69行
open('index.md' ,'r',encoding='utf8') #85行
open(os.path.join("static-files", "html", "README.md"), "w",encoding='utf8') #87行
如上所述,我是否可以根據您的筆記用於自己實驗室同學的 Python 教學嗎?並且更新適應 Python3 環境與繁體中文?
自己也简单看了一下nbconvert,nbconvert无export_html模块,没有实现批量转换(green-hand一枚),有谁能帮忙做一下新的转换文件。
运行python generate_static_files.py 命令 ,希望生成文件报错,报错:
bogon:notes-python wingjoy$ python generate_static_files.py
File "generate_static_files.py", line 71
print file_name
^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(print file_name)?
[NOT AN ISSUE.]
Could someone volunteer to convert these IPYNBs into English?
I find that nbviewer.jupyter.org can convert .jpynb to html, but it only support single jpynb file. So how can I convert the whole repo into a pdf which is more easy to read.
thanks
RT,求解决,
具体的问题原因未知emmmm
In [4]:
%timeit for row in lst: list(row)
100 loops, best of 3: 4.12 ms per loop
In [5]:
%timeit for row in tup: tuple(row)
100 loops, best of 3: 2.07 ms per loop
这个地方有个疑问,我理解的话,这里差距的产生和list(row)与tuple(row)的速度有关吧?实际遍历的速度应该是差不多吧
os.path.slitext(path):将路径与扩展名分开
os.path.splitext(path):
this 模块
print("".join([d.get(c, c) for c in s]))
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.