本文整理汇总了Python中pyexcel_io.book.BookReader类的典型用法代码示例。如果您正苦于以下问题:Python BookReader类的具体用法?Python BookReader怎么用?Python BookReader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了BookReader类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self):
BookReader.__init__(self)
self._file_type = constants.FILE_FORMAT_CSV
self.__load_from_memory_flag = False
self.__line_terminator = DEFAULT_NEWLINE
self.__sheet_name = None
self.__sheet_index = None
示例2: open_stream
def open_stream(
self,
file_stream,
skip_hidden_sheets=True,
detect_merged_cells=False,
skip_hidden_row_and_column=True,
**keywords
):
BookReader.open_stream(self, file_stream, **keywords)
self.skip_hidden_sheets = skip_hidden_sheets
self.skip_hidden_row_and_column = skip_hidden_row_and_column
self.detect_merged_cells = detect_merged_cells
self._load_the_excel_file(file_stream)
示例3: open_content
def open_content(self, file_content, **keywords):
if compact.PY27_ABOVE:
import mmap
encoding = keywords.get('encoding', 'utf-8')
if isinstance(file_content, mmap.mmap):
# load from mmap
self.__multiple_sheets = keywords.get('multiple_sheets', False)
self._file_stream = CSVMemoryMapIterator(
file_content, encoding)
self._keywords = keywords
self._native_book = self._load_from_stream()
else:
if compact.PY3_ABOVE:
if isinstance(file_content, bytes):
file_content = file_content.decode(encoding)
# else python 2.7 does not care about bytes nor str
BookReader.open_content(
self, file_content, **keywords)
else:
BookReader.open_content(
self, file_content, **keywords)
示例4: open_content
def open_content(self, file_content, **keywords):
try:
import mmap
encoding = keywords.get("encoding", "utf-8")
if isinstance(file_content, mmap.mmap):
# load from mmap
self.__multiple_sheets = keywords.get("multiple_sheets", False)
self._file_stream = CSVMemoryMapIterator(
file_content, encoding
)
self._keywords = keywords
self._native_book = self._load_from_stream()
else:
if compact.PY3_ABOVE:
if isinstance(file_content, bytes):
file_content = file_content.decode(encoding)
# else python 2.7 does not care about bytes nor str
BookReader.open_content(self, file_content, **keywords)
except ImportError:
# python 2.6 or Google app engine
BookReader.open_content(self, file_content, **keywords)
示例5: open_stream
def open_stream(self, file_stream, multiple_sheets=False, **keywords):
BookReader.open_stream(self, file_stream, **keywords)
self.__multiple_sheets = multiple_sheets
self._native_book = self._load_from_stream()
示例6: open_stream
def open_stream(self, file_stream, **keywords):
"""load ods from file stream"""
BookReader.open_stream(self, file_stream, **keywords)
self._load_from_memory()
示例7: open
def open(self, file_name, **keywords):
"""load ods from file"""
BookReader.open(self, file_name, **keywords)
self._load_from_file()
示例8: open
def open(self, file_name, **keywords):
BookReader.open(self, file_name, **keywords)
self._get_params()
示例9: open_stream
def open_stream(self, file_stream, **keywords):
BookReader.open_stream(self, file_stream, **keywords)
self._native_book = self._load_from_file_alike_object(
self._file_stream)
示例10: __init__
def __init__(self):
BookReader.__init__(self)
self._file_type = FILE_FORMAT_CSVZ
self.zipfile = None
示例11: open_stream
def open_stream(self, file_stream, **keywords):
self.__parse_keywords(**keywords)
BookReader.open_stream(self, file_stream, **keywords)
示例12: open
def open(self, file_name, **keywords):
self.__parse_keywords(**keywords)
BookReader.open(self, file_name, **keywords)
示例13: __init__
def __init__(self):
BookReader.__init__(self)
self._file_content = None
self.__skip_hidden_sheets = True
self.__skip_hidden_row_column = True
self.__detect_merged_cells = False
示例14: test_book_reader_open_stream
def test_book_reader_open_stream():
reader = BookReader()
reader.open_stream("a string")
示例15: test_book_reader
def test_book_reader():
reader = BookReader()
reader.read_sheet(1)