# 修改前
url_scheme = urlparse(path).scheme
if url_scheme =='':withopen(path)as fh:
data = fh.read()elif url_scheme in('http','https'):
data = urlopen(path).read()else:raise ThriftParserError('ThriftPy does not support generating module ''with path in protocol \'{}\''.format(
url_scheme))# 修改后
url_scheme = urlparse(path).scheme
if url_scheme =='':withopen(path)as fh:
data = fh.read()elif url_scheme in('c','d','e','f'):# 代表c盘、d盘、e盘、f盘等withopen(path)as fh:
data = fh.read()elif url_scheme in('http','https'):
data = urlopen(path).read()else:raise ThriftParserError('ThriftPy does not support generating module ''with path in protocol \'{}\''.format(
url_scheme))
# DOCS: http://happybase.readthedocs.io/en/latest/api.html#happybase.Connection.create_table# create_table(name, families)# name (str) – The table name# families (dict) – The name and options for each column family
families ={'cf1':dict(max_versions=10),'cf2':dict(max_versions=1, block_cache_enabled=False),'cf3':dict(),# use defaults}
connection.create_table('mytable', families)