This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from math import * | |
import numpy as np | |
import matplotlib.pyplot as plt | |
def f1(x): | |
return x*x | |
x = np.arange(0,1.0,0.01) | |
plt.plot(x,f1(x),label=r"$y=x^2$") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib.mathtext as mt | |
s = r'$\int_{0}^{\frac{\sqrt{2}}{2}} 1-x^2 dx - \int_{0}^{\frac{\sqrt{2}}{2}} x^2 dx + \int_{\frac{\sqrt{2}}{2}}^{1} 1-x^2 dx$' | |
m = mt.MathTextParser("Bitmap") | |
m.to_png('test.png',s) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def lastDigit(barcode): | |
if len(barcode)!=12: | |
return "error:wrong len" | |
else: | |
control2 = int(barcode[1])+int(barcode[3])+int(barcode[5])+int(barcode[7])+int(barcode[9])+int(barcode[11]) | |
control1 = int(barcode[0])+int(barcode[2])+int(barcode[4])+int(barcode[6])+int(barcode[8])+int(barcode[10]) | |
control = 10-(control2*3+control1)%10 | |
if control == 10: | |
control = 0 | |
return str(control) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import feedparser | |
d = feedparser.parse('http://pavel.zaikin.pro/feeds/posts/default') | |
for e in d.entries: | |
title = e.title.replace('"',"'") | |
content = e.content | |
f = open(title + ".html", "w",encoding='utf-8') | |
f.write('<html><body>') | |
f.write(content[0]['value']) | |
f.write("</body></html>") | |
f.close() |
NewerOlder