這邊用 Miniconda,選擇 Python 3.5 Windows 64-bit。
安裝 Anaconda 一樣沒有問題,兩個裡面是一樣的, 只是 Anaconda 預設下載了很多常用套件。
開一個 Command Prompt (Win+R -> cmd + [Enter]) 輸入 conda
def print_missing_number(nums): | |
should_be = 0 | |
current = 0 | |
for i, n in enumerate(nums, 1): | |
current += n | |
should_be += i | |
print(f"should_be: {should_be}, current: {current}") | |
print(should_be - current) | |
import re | |
# module global | |
room_terms_match = { | |
'rooms': r'房', | |
'livingrooms': r'廳', | |
} | |
這邊用 Miniconda,選擇 Python 3.5 Windows 64-bit。
安裝 Anaconda 一樣沒有問題,兩個裡面是一樣的, 只是 Anaconda 預設下載了很多常用套件。
開一個 Command Prompt (Win+R -> cmd + [Enter]) 輸入 conda
import logging | |
logging.basicConfig(level=logging.INFO) | |
import alog | |
from threading import Thread | |
from multiprocessing import Process | |
def make_log(name, x): | |
def logging(): | |
for i in range(5): |
import alog | |
from threading import Thread | |
from multiprocessing import Process | |
def make_log(x): | |
def logging(): | |
for i in range(5): | |
alog.info("loging {}:{}".format(x, i)) | |
return logging |
import time | |
import concurrent.futures | |
import rx | |
num_stream = [1, 2, 3, 4, 5] | |
def heavy_work(data): | |
time.sleep(1) | |
return data |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
""" | |
Usage: | |
1. Enter your plim templates folder | |
cd app/templates | |
2. Run this Python script | |
python bulk_compile_plims.py | |
3. Check it out | |
tree __plim_output | |
""" | |
from pathlib import Path |
________________ TestAssetSpecs.test_asset_spec_no_static_view _________________ | |
self = <pyramid_webassets.tests.test_webassets.TestAssetSpecs testMethod=test_asset_spec_no_static_view> | |
def test_asset_spec_no_static_view(self): | |
from webassets import Bundle | |
self.create_files({ | |
'dotted/__init__.py': '', | |
'dotted/package/__init__.py': '', |