PyPark is Web Service that can run Python code on your browser.
You can run Python script by Twitter. If you tweet "@python_park [Python script]", you'll get reply from @python_park. Follow @python_park
@python_park print "Hello World"
def func(var): return "{" + var + "}" print map(func, ["Java", "C++", "Python", "Ruby", "Perl"])
def decorate(func): print "it's decorate", func.__name__ return func @decorate def hoge(): print "hoge" hoge()
def prjeuler1(max): sum = 0 for i in range(1, max): if (i % 3) == 0 or (i % 5) == 0: sum += i return sum #確認 if prjeuler1(10) == 23: print "TEST OK" else: print "TEST NG" #本番 print "答えは", prjeuler1(1000)
import urllib2 import re html = urllib2.urlopen("http://stocks.finance.yahoo.co.jp/stocks/detail/?code=998407.O").read() kabuka = re.search(r"\d,\d{3}\.\d{2}",html).group() print kabuka
print (1, 2, 3) < (1, 2, 4) print [1, 2, 3] < [1, 2, 4] print 'ABC' < 'C' < 'Pascal' < 'Python' print (1, 2, 3, 4) < (1, 2, 4) print (1, 2) < (1, 2, -1) print (1, 2, 3) == (1.0, 2.0, 3.0) print (1, 2, ('aa', 'ab')) < (1, 2, ('abc', 'a'), 4)
print 1.0/0.3
def simple_range(max): i = 0 while i < max: yield i i += 1 for i in simple_range(10): print i
print 1/3
import time now = time.strftime('%Y年%m月%d日 %H時%M分%S秒') print now
list = [1, 2, 3] for i in list: print i