当前位置: 首页>>代码示例>>Python>>正文


Python BookReader.open_content方法代码示例

本文整理汇总了Python中pyexcel_io.book.BookReader.open_content方法的典型用法代码示例。如果您正苦于以下问题:Python BookReader.open_content方法的具体用法?Python BookReader.open_content怎么用?Python BookReader.open_content使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyexcel_io.book.BookReader的用法示例。


在下文中一共展示了BookReader.open_content方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: open_content

# 需要导入模块: from pyexcel_io.book import BookReader [as 别名]
# 或者: from pyexcel_io.book.BookReader import open_content [as 别名]
 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)
开发者ID:caspartse,项目名称:QQ-Groups-Spider,代码行数:23,代码来源:csvr.py

示例2: open_content

# 需要导入模块: from pyexcel_io.book import BookReader [as 别名]
# 或者: from pyexcel_io.book.BookReader import open_content [as 别名]
    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)
开发者ID:pyexcel,项目名称:pyexcel-io,代码行数:24,代码来源:csvr.py


注:本文中的pyexcel_io.book.BookReader.open_content方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。