Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
# coding=UTF-8 | |
from __future__ import division | |
import re | |
# This is a naive text summarization algorithm | |
# Created by Shlomi Babluki | |
# April, 2013 | |
class SummaryTool(object): |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Leaflet</title> | |
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.3.1/leaflet.css" /> | |
<script src="http://cdn.leafletjs.com/leaflet-0.3.1/leaflet.js"></script> | |
<script src="http://maps.google.com/maps/api/js?v=3.2&sensor=false"></script> | |
<script src="http://matchingnotes.com/javascripts/leaflet-google.js"></script> | |
</head> | |
<body> |
Tracing route to FIN [216.81.59.173]: | |
1 76 ms 96 ms 99 ms 192.168.1.254 | |
2 * * * Request timed out. | |
3 18 ms 18 ms 17 ms 195.66.225.189 | |
4 22 ms 24 ms 24 ms 10gigabitethernet1-1.core1.lon1.he.net [195.66.224.21] | |
5 24 ms 24 ms 24 ms 10gigabitethernet2-4.core1.par2.he.net [72.52.92.42] | |
6 97 ms 97 ms 100 ms 10gigabitethernet7-1.core1.ash1.he.net [184.105.213.93] | |
7 109 ms 109 ms 112 ms 10gigabitethernet1-2.core1.atl1.he.net [184.105.213.110] | |
8 109 ms 108 ms 108 ms 216.66.0.26 |
아희 유형 A 프로그래밍 언어 설명 문서 - draft 버전 1.2.0
한국어는 애매합니다. 정확히는 명료한 언어 설명 문서를 적기에는 부족한 점이 좀 있습니다. 따라서, 본론에 들어가기 전 몇 가지 표현을 미리 명료히 하겠습니다.
가
(U+AC00) 이상 힣
(U+D7A3) 이하: 유니코드의 문자 번호가 십육진수 표기로 AC00 이상 D7A3 이하에 속하는 모든 유니코드 문자를 칭합니다.""" | |
A PyYAML loader that annotates position in source code. | |
The loader is based on `SafeConstructor`, i.e., the behaviour of | |
`yaml.safe_load`, but in addition: | |
- Every dict/list/unicode is replaced with dict_node/list_node/unicode_node, | |
which subclasses dict/list/unicode to add the attributes `start_mark` | |
and `end_mark`. (See the yaml.error module for the `Mark` class.) |
from subprocess import Popen | |
import os, subprocess | |
def parseEnv(envoutput): | |
handle_line = lambda l: tuple(l.rstrip().split("=", 1)) | |
pairs = map(handle_line, envoutput) | |
valid_pairs = filter(lambda x: len(x) == 2, pairs) | |
valid_pairs = [(x[0].upper(), x[1]) for x in valid_pairs] | |
return dict(valid_pairs) |
/* | |
code | |
{ | |
char: string, | |
cho: number, | |
jung: number, | |
jong: number, | |
eliminate: boolean | |
} | |
*/ |
// From rust get `libstd/libc.rs` to the working dir. | |
// From rust-windows <https://github.com/klutzy/rust-windows> | |
// copy whole `ll/` dir to the working dir and | |
// patch some code: (TODO) | |
// From win32.js <https://github.com/klutzy/win32.js>, copy | |
// `library_win32.js` and `window.js` to working dir. | |
// | |
// emscripten uses le32-unknown-nacl triple but rustc doesn't know it now. | |
// So just use similar target instead. | |
// Here I use `win32` because libc.rs needs it. |
import re | |
import urllib | |
from bs4 import BeautifulSoup | |
import datetime | |
def read_percentage(soup): | |
return float(re.search(r'\((\d+\.\d+)\)',repr(soup)).groups()[0]) | |
f = urllib.urlopen('http://info.nec.go.kr/electioninfo/electionInfo_report.xhtml?electionId=0020121219&requestURI=%2Felectioninfo%2F0020121219%2Fvc%2Fvccp09.jsp&topMenuId=VC&secondMenuId=VCCP&menuId=VCCP09&statementId=VCCP09_%231&electionCode=1&cityCode=0&sggCityCode=0&x=26&y=8') | |
html = f.read() |