Python3.3 で pysqlite をインストールしようとしたらうまくいかない。 検索したけど、有効な解決策が見つからなかった。
% python -V Python 3.3.3 % pip install pysqlite Downloading/unpacking pysqlite Running setup.py egg_info for package pysqlite
import re | |
# ref: Regular Expression Cookbook p.26 | |
text = """!\"#$%&'()*+,-./:;<=>?@[\]^_`{|}~ | |
aaa | |
bbb | |
""" | |
# http://docs.python.jp/2.7/library/linecache.html | |
import linecache | |
linecache.getline("test.txt", 10) |
import csv | |
data_reader = csv.reader(open("./data.csv")) | |
for row_list in data_reader: | |
','.join(row_list) |
Python3.3 で pysqlite をインストールしようとしたらうまくいかない。 検索したけど、有効な解決策が見つからなかった。
% python -V Python 3.3.3 % pip install pysqlite Downloading/unpacking pysqlite Running setup.py egg_info for package pysqlite
# -*- coding: utf-8 -*- | |
""" | |
GF(仮) Wiki からセンバツボーナス一覧を取得し、標準出力に出力する。 | |
以下のフォーマットの csv として出力する。 | |
ガールNo, ガール名, ガールタイプ, 功セン1, 功セン2, 功セン3, 守セン1, 守セン2, 守セン3 | |
事前準備 | |
-------- |
# -*- coding: utf-8 -*- | |
# requirement: lxml | |
import requests | |
from bs4 import BeautifulSoup | |
URL = "https://gist.github.com/" | |
def get_soup(url=URL): | |
""" get soup object of url. |
# -*- coding: utf-8 -*- | |
def is_some_of_values_over_n(d, n, m): | |
""" at least m (in d) properties' count is larger than or equal to n, return the list of the properties. | |
if not, return False. | |
""" | |
s_over_n_list = [] | |
for s, count in d.iteritems(): | |
if count >= n: |
# -*- coding: utf-8 -*- | |
# 参考: http://omake.accense.com/static/doc-ja/sqlalchemy/ormtutorial.html | |
from sqlalchemy import create_engine | |
from sqlalchemy import Table, Column, Integer, String, MetaData | |
from sqlalchemy.orm import mapper | |
from sqlalchemy.orm import sessionmaker | |
# -*- coding: utf-8 -*- | |
# 参考: Python クックブック第2版 p.199 | |
def sort_case_insensitive(l): | |
""" in place sort string list (case insensitive) | |
Argument: | |
l (list) |
# -*- coding: utf-8 -*- | |
# 参考: Python クックブック第2版 p.198 | |
def get_sorted_dict_values(d): | |
keys = d.keys() | |
keys.sort() | |
return [d[key] for key in keys] |