我一直在搜索如何在网页中嵌入一个交互式matplotlib小部件(如下所示:http://matplotlib.org/examples/widgets/slider_demo.html).最终目标是制作教育页面.
我希望我不会重复这个问题.谷歌发现的总是如何以图像格式将情节嵌入静止图像中.
我以为我可以用ipython笔记本或剧情或gjango做点什么.但我很困惑.
是否有可能用于吸引人的情节?我很感谢你的导游我应该思考和工作的方向.
谢谢.
愿有人请解释我为什么np.array([1e5])**2
不等同于np.array([100000])**2
?来自Matlab,我发现它令人困惑!
>>> np.array([1e5])**2
array([ 1.00000000e+10]) # correct
>>> np.array([100000])**2
array([1410065408]) # Why??
Run Code Online (Sandbox Code Playgroud)
我发现此行为从1e5开始,因为下面的代码给出了正确的结果:
>>> np.array([1e4])**2
array([ 1.00000000e+08]) # correct
>>> np.array([10000])**2
array([100000000]) # and still correct
Run Code Online (Sandbox Code Playgroud) 我已经编写了我的程序来从文本文件中读取单词并将它们输入到 sqlite 数据库中,并将其视为字符串。但我需要输入一些包含日耳曼语 umlates 的单词:äöüß。
这是一段准备好的代码:
我用 # - - 编码:iso-8859-15 - - 和 # - - 编码:utf-8 - - 没有区别(!)
# -*- coding: iso-8859-15 -*-
import sqlite3
dbname = 'sampledb.db'
filename ='text.txt'
con = sqlite3.connect(dbname)
cur = con.cursor()
cur.execute('''create table IF NOT EXISTS table1 (id INTEGER PRIMARY KEY,name)''')
#f=open(filename)
#text = f.readlines()
#f.close()
text = u'süß'
print (text)
cur.execute("insert into table1 (id,name) VALUES (NULL,?)",(text,))
con.commit()
sentence = "The name is: %s" %(text,)
print (sentence)
f.close()
con.close()
Run Code Online (Sandbox Code Playgroud)
上面的代码运行良好。但我需要从包含“süß”一词的文件中读取“文本”。因此,当我取消注释 3 行( …