$ Measure-Command { Start-Process python -argumentList "test1.py" -Wait -NoNewWindow }
-Wait
と -NoNewWindow
をつけないとうまくいかない。
import sympy | |
# 指数部分を定義 (マイナス2分の1乗) | |
n = -sympy.Rational(1, 2) | |
print(n) | |
# 8のマイナス2分の1乗を求める | |
r = 8**n |
import sympy | |
# x を定義 | |
x = sympy.Symbol('x') | |
# 式定義 | |
# x^3 - 2x^2 - 5x + 6 | |
expr = x**3 - 2*(x**2) - 5*x + 6 | |
print(expr) |
""" | |
Reactive Python (RxPy) のサンプル | |
2018/04/13:まだ途中 | |
REFERENCES:: | |
https://auth0.com/blog/reactive-programming-in-python/ | |
https://github.com/ReactiveX/RxPY | |
""" | |
import threading |
""" | |
Sentry と logging の組み合わせのサンプル | |
DSN は 環境変数 SENTRY_DSN に設定してから起動します。 | |
(*) Windowsの場合、一時設定するには以下のようにします。 | |
$ set SENTRY_DSN=xxxxx | |
REFERENCES:: | |
https://docs.python.jp/3/library/logging.config.html#logging-config-dictschema | |
https://docs.sentry.io/clients/python/integrations/logging/ |
{ | |
"version": 1, | |
"disable_existing_loggers": "true", | |
"formatters": { | |
"console": { | |
"format": "[%(asctime)s][%(levelname)s] %(name)s %(filename)s:%(funcName)s:%(lineno)d | %(message)s", | |
"datefmt": "%Y/%m/%d %H:%M:%S" | |
} | |
}, | |
"handlers": { |
""" | |
起動引数で指定された fd (ファイルディスクリプタ) を使ってデータを読み取り表示します。 | |
(注意) subprocess.popen経由で呼び出されることを想定しています。 | |
""" | |
import itertools | |
import os | |
import sys | |
def go(): |