本文由 大侠(AhcaoZhu)原创,转载请声明。
链接: https://blog.csdn.net/Ahcao2008
一图看懂 pyexcel 模块:提供统一 API用来读写操作 Excel 文件的库, 资料整理+笔记(大全)
- 摘要
- 模块图
- 类关系图
- 模块全展开
- 【pyexcel】
- 统计
- 常量
- 模块
- 1 pyexcel._compact
- 2 pyexcel.constants
- 3 pyexcel.exceptions
- 4 pyexcel.plugins
- 5 pyexcel.docstrings
- 6 pyexcel.internal
- 7 pyexcel.sheet
- 8 pyexcel.book
- 9 pyexcel.core
- 10 pyexcel.cookbook
- 11 pyexcel.deprecated
- 函数
- 12 save_as(**keywords)
- 13 get_book(**keywords)
- 14 get_dict(name_columns_by_row=0, **keywords)
- 15 isave_as(**keywords)
- 16 get_array(**keywords)
- 17 get_sheet(**keywords)
- 18 iget_book(**keywords)
- 19 iget_array(**keywords)
- 20 get_records(name_columns_by_row=0, **keywords)
- 21 iget_records(custom_headers=None, **keywords)
- 22 save_book_as(**keywords)
- 23 get_book_dict(**keywords)
- 24 isave_book_as(**keywords)
- 25 split_a_book(file_name, outfilename=None)
- 26 merge_all_to_a_book(filelist, outfilename='merged.xls')
- 27 merge_csv_to_a_book(filelist, outfilename='merged.xls')
- 28 extract_a_sheet_from_a_book(file_name, sheetname, outfilename=None)
- 29 inner(*arg, **keywords)
- 39 free_resources()
- 类
- 40 pyexcel.book.Book
- method
- 1 init(self, sheets=None, filename="memory", path=None)
- 2 load_from_sheets(self, sheets)
- 3 number_of_sheets(self)
- 4 remove_sheet(self, sheet)
- 5 sheet_by_index(self, index)
- 6 sheet_by_name(self, name)
- 7 sheet_names(self)
- 8 sort_sheets(self, key=None, reverse=False)
- 9 to_dict(self)
- 41 pyexcel.sheet.Sheet
- property
- method
- 4 clone(self)
- 5 delete_columns(self, column_indices)
- 6 delete_named_column_at(self, name)
- 7 delete_named_row_at(self, name)
- 8 delete_rows(self, row_indices)
- 9 extend_columns(self, columns)
- 10 extend_columns_with_rows(self, rows)
- 11 extend_rows(self, rows)
- 12 group_rows_by_column(self, column_index_or_name)
- 13 init()
- 14 name_columns_by_row(self, row_index)
- 15 name_rows_by_column(self, column_index)
- 16 named_column_at(self, name)
- 17 named_columns(self)
- 18 named_row_at(self, name)
- 19 named_rows(self)
- 20 project(self, new_ordered_columns, exclusion=False)
- 21 set_named_column_at(self, name, column_array)
- 22 set_named_row_at(self, name, row_array)
- 23 to_array(self)
- 24 to_dict(self, row=False)
- 25 to_records(self, custom_headers=None)
- 26 top(self, lines=5)
- 27 top_left(self, rows=5, columns=5)
- 28 transpose(self)
- 私有或局部
- 【pyexcel._compact】
- 【pyexcel.constants】
- 【pyexcel.exceptions】
- 【pyexcel.plugins】
- 【pyexcel.docstrings】
- 【pyexcel.internal】
- 【pyexcel.sheet】
- 【pyexcel.book】
- 【pyexcel.core】
- 【pyexcel.cookbook】
- 【pyexcel.deprecated】
- 【sys】
- 【warnings】
- 【urllib.request】
- 统计
- 常量
- int
- bool
- list
- dict
- 模块
- 5 base64
- 6 bisect
- 7 email
- 8 hashlib
- 9 http
- 10 io
- 11 os
- 12 posixpath
- 13 re
- 14 socket
- 15 string
- 16 sys
- 17 time
- 18 tempfile
- 19 contextlib
- 20 warnings
- 21 ssl
- 函数
- 22 urlparse(url, scheme='', allow_fragments=True)
- 23 urlsplit(url, scheme='', allow_fragments=True)
- 24 urljoin(base, url, allow_fragments=True)
- 25 unwrap(url)
- 26 quote(string, safe='/', encoding=None, errors=None)
- 27 unquote(string, encoding='utf-8', errors='replace')
- 28 splittype(url)
- 29 splithost(url)
- 30 splitport(host)
- 31 splituser(host)
- 32 splitpasswd(user)
- 33 splitattr(url)
- 34 splitquery(url)
- 35 splitvalue(attr)
- 36 splittag(url)
- 37 to_bytes(url)
- 38 unquote_to_bytes(string)
- 39 urlunparse(components)
- 40 urlopen(url, data=None, timeout=<object object at 0x00000000003C7FD0>, *, cafile=None, capath=None, cadefault=False, context=None)
- 41 install_opener(opener)
- 42 urlretrieve(url, filename=None, reporthook=None, data=None)
- 43 urlcleanup()
- 44 request_host(request)
- 45 build_opener(*handlers)
- 46 _parse_proxy(proxy)
- 47 parse_keqv_list(l)
- 48 parse_http_list(s)
- 49 _safe_gethostbyname(host)
- 50 url2pathname(url)
- 51 pathname2url(p)
- 52 localhost()
- 53 thishost()
- 54 ftperrors()
- 55 noheaders()
- 56 getproxies_environment()
- 57 proxy_bypass_environment(host, proxies=None)
- 58 _proxy_bypass_macosx_sysconf(host, proxy_settings)
- 59 getproxies_registry()
- 60 getproxies()
- 61 proxy_bypass_registry(host)
- 62 proxy_bypass(host)
- 类
- 63 urllib.error.URLError
- 64 urllib.error.HTTPError
- property
- 65 urllib.error.ContentTooShortError
- 66 urllib.response.addinfourl
- method
- 1 getcode(self)
- 2 geturl(self)
- 67 urllib.response.addclosehook
- method
- 1 close(self)
- 68 urllib.request.Request
- property
- method
- 3 add_header(self, key, val)
- 4 add_unredirected_header(self, key, val)
- 5 get_full_url(self)
- 6 get_header(self, header_name, default=None)
- 7 get_method(self)
- 8 has_header(self, header_name)
- 9 has_proxy(self)
- 10 header_items(self)
- 11 remove_header(self, header_name)
- 12 set_proxy(self, host, type)
- 69 urllib.request.OpenerDirector
- method
- 1 add_handler(self, handler)
- 2 close(self)
- 3 error(self, proto, *args)
- 4 open(self, fullurl, data=None, timeout=socket._GLOBAL_DEFAULT_TIMEOUT)
- 70 urllib.request.BaseHandler
- data
- method
- 2 add_parent(self, parent)
- 3 close(self)
- 71 urllib.request.HTTPErrorProcessor
- data
- method
- 2 http_response(self, request, response)
- 3 https_response()
- 72 urllib.request.HTTPDefaultErrorHandler
- method
- 1 http_error_default(self, req, fp, code, msg, hdrs)
- 73 urllib.request.HTTPRedirectHandler
- data
- method
- 4 http_error_301(self, url, fp, errcode, errmsg, headers, data=None)
- 5 http_error_302(self, req, fp, code, msg, headers)
- 6 http_error_303(self, url, fp, errcode, errmsg, headers, data=None)
- 7 http_error_307(self, url, fp, errcode, errmsg, headers, data=None)
- 8 redirect_request(self, req, fp, code, msg, headers, newurl)
- 74 urllib.request.ProxyHandler
- data
- method
- 2 proxy_open(self, req, proxy, type)
- 75 urllib.request.HTTPPasswordMgr
- method
- 1 add_password(self, realm, uri, user, passwd)
- 2 find_user_password(self, realm, authuri)
- 3 is_suburi(self, base, test)
- 4 reduce_uri(self, uri, default_port=True)
- 76 urllib.request.HTTPPasswordMgrWithDefaultRealm
- method
- 1 find_user_password(self, realm, authuri)
- 77 urllib.request.HTTPPasswordMgrWithPriorAuth
- method
- 1 add_password(self, realm, uri, user, passwd, is_authenticated=False)
- 2 is_authenticated(self, authuri)
- 3 update_authenticated(self, uri, is_authenticated=False)
- 78 urllib.request.AbstractBasicAuthHandler
- data
- method
- 2 http_error_auth_reqed(self, authreq, host, req, headers)
- 3 http_request(self, req)
- 4 http_response(self, req, response)
- 5 https_request()
- 6 https_response()
- 7 retry_http_basic_auth(self, host, req, realm)
- 79 urllib.request.HTTPBasicAuthHandler
- data
- method
- 2 http_error_401(self, req, fp, code, msg, headers)
- 80 urllib.request.ProxyBasicAuthHandler
- data
- method
- 2 http_error_407(self, req, fp, code, msg, headers)
- 81 urllib.request.AbstractDigestAuthHandler
- method
- 1 get_algorithm_impls(self, algorithm)
- 2 get_authorization(self, req, chal)
- 3 get_cnonce(self, nonce)
- 4 get_entity_digest(self, data, chal)
- 5 http_error_auth_reqed(self, auth_header, host, req, headers)
- 6 reset_retry_count(self)
- 7 retry_http_digest_auth(self, req, auth)
- 82 urllib.request.HTTPDigestAuthHandler
- data
- method
- 3 http_error_401(self, req, fp, code, msg, headers)
- 83 urllib.request.ProxyDigestAuthHandler
- data
- method
- 3 http_error_407(self, req, fp, code, msg, headers)
- 84 urllib.request.AbstractHTTPHandler
- method
- 1 do_open(self, http_class, req, **http_conn_args)
- 2 do_request_(self, request)
- 3 set_http_debuglevel(self, level)
- 85 urllib.request.HTTPHandler
- method
- 1 http_open(self, req)
- 2 http_request(self, request)
- 86 urllib.request.HTTPSHandler
- method
- 1 https_open()
- 2 https_request()
- 87 urllib.request.HTTPCookieProcessor
- method
- 1 http_request(self, request)
- 2 http_response(self, request, response)
- 3 https_request()
- 4 https_response()
- 88 urllib.request.UnknownHandler
- method
- 1 unknown_open(self, req)
- 89 urllib.request.FileHandler
- data
- method
- 2 file_open(self, req)
- 3 get_names(self)
- 4 open_local_file(self, req)
- 90 urllib.request.FTPHandler
- method
- 1 connect_ftp(self, user, passwd, host, port, dirs, timeout)
- 2 ftp_open(self, req)
- 91 urllib.request.CacheFTPHandler
- method
- 1 check_cache(self)
- 2 clear_cache(self)
- 3 connect_ftp(self, user, passwd, host, port, dirs, timeout)
- 4 setMaxConns(self, m)
- 5 setTimeout(self, t)
- 92 urllib.request.DataHandler
- method
- 1 data_open(self, req)
- 93 urllib.request.URLopener
- data
- method
- 2 addheader(self, *args)
- 3 cleanup(self)
- 4 close(self)
- 5 http_error(self, url, fp, errcode, errmsg, headers, data=None)
- 6 http_error_default(self, url, fp, errcode, errmsg, headers)
- 7 open(self, fullurl, data=None)
- 8 open_data(self, url, data=None)
- 9 open_file(self, url)
- 10 open_ftp(self, url)
- 11 open_http(self, url, data=None)
- 12 open_https(self, url, data=None)
- 13 open_local_file(self, url)
- 14 open_unknown(self, fullurl, data=None)
- 15 open_unknown_proxy(self, proxy, fullurl, data=None)
- 16 retrieve(self, url, filename=None, reporthook=None, data=None)
- 94 urllib.request.FancyURLopener
- method
- 1 get_user_passwd(self, host, realm, clear_cache=0)
- 2 http_error_301(self, url, fp, errcode, errmsg, headers, data=None)
- 3 http_error_302(self, url, fp, errcode, errmsg, headers, data=None)
- 4 http_error_303(self, url, fp, errcode, errmsg, headers, data=None)
- 5 http_error_307(self, url, fp, errcode, errmsg, headers, data=None)
- 6 http_error_401(self, url, fp, errcode, errmsg, headers, data=None,
- 7 http_error_407(self, url, fp, errcode, errmsg, headers, data=None,
- 8 http_error_default(self, url, fp, errcode, errmsg, headers)
- 9 prompt_user_passwd(self, host, realm)
- 10 redirect_internal(self, url, fp, errcode, errmsg, headers, data)
- 11 retry_http_basic_auth(self, url, realm, data=None)
- 12 retry_https_basic_auth(self, url, realm, data=None)
- 13 retry_proxy_http_basic_auth(self, url, realm, data=None)
- 14 retry_proxy_https_basic_auth(self, url, realm, data=None)
- 95 urllib.request.ftpwrapper
- method
- 1 close(self)
- 2 endtransfer(self)
- 3 file_close(self)
- 4 init(self)
- 5 real_close(self)
- 6 retrfile(self, file, type)
- 内嵌函数或方法
- 私有或局部
- 剩余
- 【types】
- 统计
- 常量
- 函数
- 1 new_class(name, bases=(), kwds=None, exec_body=None)
- 2 resolve_bases(bases)
- 3 prepare_class(name, bases=(), kwds=None)
- 4 _calculate_meta(meta, bases)
- 5 coroutine(func)
- 类
- 6 function
- 6、7 function
- 8 code
- 9 mappingproxy
- 10 types.SimpleNamespace
- 11 generator
- 12 coroutine
- 13 async_generator
- 14 method
- 15 builtin_function_or_method
- 17 wrapper_descriptor
- 18 method-wrapper
- 19 method_descriptor
- 20 classmethod_descriptor
- 21 module
- 22 traceback
- 23 frame
- 24 getset_descriptor
- 25 member_descriptor
- 26 types.DynamicClassAttribute
- method
- 1 deleter(self, fdel)
- 2 getter(self, fget)
- 3 setter(self, fset)
- 27 types._GeneratorWrapper
- property
- method
- 9 close(self)
- 10 send(self, val)
- 11 throw(self, tp, *rest)
- 私有或局部
- 【pyexcel.plugins.parsers】
- 统计
- 常量
- str
- 类
- 3 pyexcel.plugins.PyexcelPluginChain
- method
- 1 add_a_output_source(self, relative_plugin_class_path=None, **keywords)
- 2 add_a_parser(self, relative_plugin_class_path=None, file_types=None)
- 3 add_a_renderer(
- 4 add_a_source(self, relative_plugin_class_path=None, **keywords)
- 5 add_an_input_source(self, relative_plugin_class_path=None, **keywords)
- 剩余
- 【pyexcel.plugins.renderers】
- 统计
- 常量
- str
- 类
- 3 pyexcel.plugins.PyexcelPluginChain
- 剩余
- 【pyexcel.plugins.sources】
- 统计
- 常量
- 类
- 1 pyexcel.plugins.PyexcelPluginChain
- 剩余
- 【pyexcel.docstrings.keywords】
- 统计
- 常量
- str
- 1 CSV_PARAMS
- 2 XLRD_PARAMS
- 3 OPTIONAL_BOOK_PARAMS
- 4 OPTIONAL_PARAMS
- 5 FILE_PARAMS
- 6 SKIPPING_FUNC_PROTOCOL
- 7 PAGINATION_PARAMS
- 8 SOURCE_PARAMS
- 9 SOURCE_PARAMS_TABLE
- 10 DEST_FILE_PARAMS
- 11 DEST_PARAMS
- 12 DEST_PARAMS_TABLE
- 13 DEST_BOOK_PARAMS
- 14 SOURCE_BOOK_PARAMS
- 15 SOURCE_BOOK_PARAMS_TABLE
- 16 I_NOTE
- 17 EXAMPLE_NOTE_PAGINATION
- 【pyexcel.docstrings.core】
- 【pyexcel.docstrings.meta】
- 统计
- 常量
- str
- 【pyexcel.docstrings.garbagecollector】
- 统计
- 常量
- str
- 【pyexcel.internal.plugins】
- 【pyexcel.internal.common】
- 统计
- 常量
- str
- 函数
- 2 get_sheet_headers(sheet)
- 3 get_book_headers_in_array(book)
- 类
- 4 pyexcel.internal.common.SheetIterator
- method
- 1 next(self)
- 【pyexcel.internal.generators】
- 统计
- 常量
- 类
- 1 collections.OrderedDict
- method
- 1 clear(self)
- 2 copy(self)
- 3 items(self)
- 4 keys(self)
- 5 move_to_end(self, key, last=True)
- 6 pop(self, key, default=__marker)
- 7 popitem(self, last=True)
- 8 setdefault(self, key, default=None)
- 9 update(*args, **kwds)
- 10 values(self)
- class method
- 11 fromkeys(cls, iterable, value=None)
- 2 pyexcel.internal.common.SheetIterator
- 2 pyexcel.internal.generators.SheetStream
- property
- method
- 2 get_internal_array(self)
- 3 to_array(self)
- 2 pyexcel.internal.generators.BookStream
- method
- 1 load_from_sheets(self, sheets)
- 2 number_of_sheets(self)
- 3 sheet_names(self)
- 4 to_dict(self)
- 【pyexcel.internal.attributes】
- 统计
- 常量
- dict
- 模块
- 2 pyexcel.constants
- 函数
- 3 register_book_attribute(target, action, attr)
- 4 register_sheet_attribute(target, action, attr)
- 5 register_an_attribute(meta_cls, target, action, attr)
- 【pyexcel.internal.source_plugin】
- 统计
- 常量
- str
- tuple
- 模块
- 3 pyexcel.constants
- 4 pyexcel.exceptions
- 5 pyexcel_io.constants
- 函数
- 6 register_book_attribute(target, action, attr)
- 7 register_sheet_attribute(target, action, attr)
- 8 _error_handler(action, **keywords)
- 9 _get_me_pypi_package_name(module_name)
- 类
- 10 lml.plugin.PluginManager
- method
- 1 dynamic_load_library()
- 2 get_a_plugin()
- 3 get_primary_key()
- 4 load_me_later()
- 5 load_me_now()
- 6 raise_exception()
- 7 register_a_plugin()
- 11 pyexcel.internal.source_plugin.SourcePluginManager
- method
- 1 get_a_plugin(
- 2 get_book_source(self, **keywords)
- 3 get_keyword_for_parameter(self, key)
- 4 get_source(self, **keywords)
- 5 get_writable_book_source(self, **keywords)
- 6 get_writable_source(self, **keywords)
- 7 load_me_later(self, plugin_info)
- 8 load_me_now(self, key, action=None, library=None, **keywords)
- 9 register_a_plugin(self, plugin_cls, plugin_info)
- 私有或局部
- 剩余
- 【pyexcel.internal.core】
- 【pyexcel.internal.utils】
- 统计
- 常量
- 函数
- 1 default_getter(attribute=None)
- 2 default_setter(attribute=None)
- 3 make_a_property(cls, attribute, doc_string, getter_func=<function default_getter at 0x0000000003AAEDC8>, setter_func=<function default_setter at 0x0000000003AB7CA8>)
- 【pyexcel.internal.meta】
- 统计
- 常量
- bool
- 模块
- 2 sys
- 3 pyexcel.constants
- 4 pyexcel.docstrings
- 函数
- 5 append_doc(value)
- 6 save_book(book, **keywords)
- 7 save_sheet(sheet, **keywords)
- 8 get_sheet_stream(**keywords)
- 9 make_a_property(cls, attribute, doc_string, getter_func=<function default_getter at 0x0000000003AAEDC8>, setter_func=<function default_setter at 0x0000000003AB7CA8>)
- 10 make_presenter(source_getter, attribute=None)
- 11 sheet_presenter(attribute=None)
- 12 book_presenter(attribute=None)
- 13 importer(attribute=None)
- 14 book_importer(attribute=None)
- 15 attribute(cls, file_type, instance_name='Sheet', description='\nGet data in {0} format\n\nYou could obtain content in {0} format by dot notation::\n\n {1}.{0}\n\nif you need to pass on more parameters, you could use::\n\n {1}.get_{0}(**keywords)\n', **keywords)
- 16 _get_book(**keywords)
- 类
- 17 functools.partial
- 18 pyexcel.internal.meta.StreamAttribute
- 19 pyexcel.internal.meta.PyexcelObject
- property
- method
- 2 plot(self, file_type="svg", **keywords)
- 3 save_to_memory(self, file_type, **keywords)
- 20 pyexcel.internal.meta.SheetMeta
- property
- method
- 19 get_array()
- 20 get_bookdict()
- 21 get_csv()
- 22 get_csvz()
- 23 get_dict()
- 24 get_html()
- 25 get_ods()
- 26 get_pdf()
- 27 get_queryset()
- 28 get_records()
- 29 get_texttable()
- 30 get_tsv()
- 31 get_tsvz()
- 32 get_url()
- 33 get_xls()
- 34 get_xlsb()
- 35 get_xlsm()
- 36 get_xlsx()
- 37 save_as(self, filename, **keywords)
- 38 save_to_database(
- 39 save_to_django_model(
- 40 save_to_memory(self, file_type, stream=None, **keywords)
- 41 set_array()
- 42 set_bookdict()
- 43 set_csv()
- 44 set_csvz()
- 45 set_dict()
- 46 set_html()
- 47 set_ods()
- 48 set_pdf()
- 49 set_queryset()
- 50 set_records()
- 51 set_texttable()
- 52 set_tsv()
- 53 set_tsvz()
- 54 set_url()
- 55 set_xls()
- 56 set_xlsb()
- 57 set_xlsm()
- 58 set_xlsx()
- class method
- 59 register_input()
- 60 register_io()
- 61 register_presentation()
- 20 pyexcel.internal.meta.BookMeta
- property
- method
- 19 get_array()
- 20 get_bookdict()
- 21 get_csv()
- 22 get_csvz()
- 23 get_dict()
- 24 get_html()
- 25 get_ods()
- 26 get_pdf()
- 27 get_queryset()
- 28 get_records()
- 29 get_texttable()
- 30 get_tsv()
- 31 get_tsvz()
- 32 get_url()
- 33 get_xls()
- 34 get_xlsb()
- 35 get_xlsm()
- 36 get_xlsx()
- 37 save_as(self, filename, **keywords)
- 38 save_to_database(
- 39 save_to_django_models(
- 40 save_to_memory(self, file_type, stream=None, **keywords)
- 41 set_array()
- 42 set_bookdict()
- 43 set_csv()
- 44 set_csvz()
- 45 set_dict()
- 46 set_html()
- 47 set_ods()
- 48 set_pdf()
- 49 set_queryset()
- 50 set_records()
- 51 set_texttable()
- 52 set_tsv()
- 53 set_tsvz()
- 54 set_url()
- 55 set_xls()
- 56 set_xlsb()
- 57 set_xlsm()
- 58 set_xlsx()
- class method
- 59 register_input()
- 60 register_io()
- 61 register_presentation()
- 私有或局部
- 剩余
- 【pyexcel.internal.sheets】
- 统计
- 常量
- 模块
- 1 pyexcel.internal.sheets.formatters
- 2 pyexcel.internal.sheets._shared
- 3 pyexcel.internal.sheets.row
- 4 pyexcel.internal.sheets.column
- 5 pyexcel.internal.sheets.extended_list
- 6 pyexcel.internal.sheets.matrix
- 函数
- 7 transpose(in_array)
- 类
- 8 pyexcel.internal.sheets.row.Row
- method
- 1 format(self, row_index=None, formatter=None, format_specs=None)
- 2 select(self, indices)
- 9 pyexcel.internal.sheets.column.Column
- method
- 1 format(self, column_index=None, formatter=None, format_specs=None)
- 2 select(self, indices)
- 10 pyexcel.internal.sheets.matrix.Matrix
- method
- 1 cell_value(self, row, column, new_value=None)
- 2 clone(self)
- 3 column_at(self, index)
- 4 column_range(self)
- 5 columns(self)
- 6 contains(self, predicate)
- 7 cut(self, topleft_corner, bottomright_corner)
- 8 delete_columns(self, column_indices)
- 9 delete_rows(self, row_indices)
- 10 enumerate(self)
- 11 extend_columns(self, columns)
- 12 extend_columns_with_rows(self, rows)
- 13 extend_rows(self, rows)
- 14 filter(self, column_indices=None, row_indices=None)
- 15 format(self, formatter)
- 16 get_internal_array(self)
- 17 map(self, custom_function)
- 18 number_of_columns(self)
- 19 number_of_rows(self)
- 20 paste(self, topleft_corner, rows=None, columns=None)
- 21 rcolumns(self)
- 22 region(self, topleft_corner, bottomright_corner)
- 23 reverse(self)
- 24 row_at(self, index)
- 25 row_range(self)
- 26 rows(self)
- 27 rrows(self)
- 28 rvertical(self)
- 29 set_column_at(self, column_index, data_array, starting=0)
- 30 set_row_at(self, row_index, data_array)
- 31 to_array(self)
- 32 transpose(self)
- 33 vertical(self)
- 私有或局部
- 【pyexcel.internal.garbagecollector】
- 统计
- 常量
- list
- 模块
- 2 pyexcel.docstrings
- 函数
- 3 append_doc(value)
- 4 append(item)
- 5 free_resources()
- 6 reset()
- 【copy】
- 【re】
- 【pyexcel_io.manager】
- 统计
- 常量
- tuple
- list
- dict
- 函数
- 5 register_stream_type(file_type, stream_type)
- 6 get_io(file_type)
- 7 get_io_type(file_type)
- 8 register_a_file_type(file_type, stream_type, mime_type)
- 类
- 9 _io.BytesIO
- 9 _io.StringIO
- 【os】
- 【pyexcel_io.constants】
- 统计
- 常量
- int
- str
- 【pyexcel.internal.sheets.formatters】
- 【pyexcel.internal.sheets._shared】
- 【pyexcel.internal.sheets.row】
- 【pyexcel.internal.sheets.column】
- 【pyexcel.internal.sheets.extended_list】
- 【pyexcel.internal.sheets.matrix】
- 【json】
- 【datetime】
摘要
全文介绍系统内置 pyexcel 模块、函数、类及类的方法和属性。
它通过代码抓取并经AI智能翻译和人工校对。
是一部不可多得的权威字典类工具书。它是系列集的一部分。后续陆续发布、敬请关注。【原创:AhcaoZhu大侠】
模块图
pyexcel
pyexcel._compact
pyexcel.constants
pyexcel.exceptions
pyexcel.plugins
pyexcel.plugins.parsers
pyexcel.plugins.renderers
pyexcel.plugins.sources
pyexcel.docstrings
pyexcel.docstrings.keywords
pyexcel.docstrings.core
pyexcel.docstrings.meta
pyexcel.docstrings.garbagecollector
pyexcel.internal
pyexcel.internal.plugins
pyexcel.internal.common
pyexcel.internal.generators
pyexcel.internal.attributes
pyexcel.internal.source_plugin
◆pyexcel_io.constants
pyexcel.internal.core
pyexcel.internal.utils
pyexcel.internal.meta
pyexcel.internal.sheets
pyexcel.internal.sheets.formatters
pyexcel.internal.sheets._shared
pyexcel.internal.sheets.row
pyexcel.internal.sheets.column
pyexcel.internal.sheets.extended_list
pyexcel.internal.sheets.matrix
pyexcel.internal.garbagecollector
pyexcel.sheet
pyexcel.book
pyexcel.core
pyexcel.cookbook
pyexcel.deprecated
类关系图
◆object
◆BaseException
◆Exception
pyexcel.exceptions.FileTypeNotSupported
pyexcel.exceptions.UnknownParameters
pyexcel.exceptions.UpgradePlugin
◆list
pyexcel.internal.sheets.extended_list.PyexcelList
◆lml.plugin.PluginInfo
pyexcel.plugins.IOPluginInfo
pyexcel.plugins.SourceInfo
pyexcel.plugins.FileSourceInfo
pyexcel.plugins.InputSourceInfo
pyexcel.plugins.OutputSourceInfo
◆lml.plugin.PluginInfoChain
pyexcel.plugins.PyexcelPluginChain
◆lml.plugin.PluginManager
pyexcel.internal.plugins.IOPluginManager
pyexcel.internal.source_plugin.SourcePluginManager
pyexcel.internal.common.SheetIterator
pyexcel.internal.generators.BookStream
pyexcel.internal.generators.SheetStream
pyexcel.internal.meta.PyexcelObject
pyexcel.internal.meta.BookMeta
pyexcel.book.Book
pyexcel.internal.meta.SheetMeta
pyexcel.internal.sheets.matrix.Matrix
pyexcel.sheet.Sheet
pyexcel.internal.meta.StreamAttribute
pyexcel.internal.sheets._shared.CommonPropertyAmongRowNColumn
pyexcel.internal.sheets.column.Column
pyexcel.internal.sheets.row.Row
pyexcel.sheet._RepresentedString
模块全展开
【pyexcel】
pyexcel, fullname=pyexcel, file=pyexcel_init_.py
**pyexcel**是一个包装器库,用于读取、操作和写入不同excel格式的数据:csv、ods、xls、xls 和 xlsm。
它不支持公式、样式和图表。
版权:(c) 2014-2022由Onni Software Ltd.
许可:新的BSD许可,详见许可
统计
序号 | 类别 | 数量 |
---|---|---|
4 | str | 7 |
6 | list | 1 |
8 | dict | 1 |
9 | module | 11 |
10 | class | 2 |
11 | function | 28 |
13 | residual | 2 |
14 | system | 11 |
15 | private | 1 |
16 | all | 52 |
常量
模块
1 pyexcel._compact
_compact, fullname=pyexcel._compact, file=pyexcel_compact.py
pyexcel._compact
兼容
版权: (c) 2014-2022 by Onni Software Ltd.
许可: New BSD License, 更多详情请参见 LICENSE。
2 pyexcel.constants
constants, fullname=pyexcel.constants, file=pyexcel\constants.py
pyexcel.constants
pyexcel中出现的常量
3 pyexcel.exceptions
exceptions, fullname=pyexcel.exceptions, file=pyexcel\exceptions.py
pyexcel.exceptions
pyexcel 中出现的异常
4 pyexcel.plugins
plugins, fullname=pyexcel.plugins, file=pyexcel\plugins_init_.py
pyexcel.plugins
插件的公共接口
5 pyexcel.docstrings
docstrings, fullname=pyexcel.docstrings, file=pyexcel\docstrings_init_.py
pyexcel.docstrings
可重构文档字符串
6 pyexcel.internal
internal, fullname=pyexcel.internal, file=pyexcel\internal_init_.py
pyexcel.internal
受更改影响的Pyexcel内部
7 pyexcel.sheet
sheet, fullname=pyexcel.sheet, file=pyexcel\sheet.py
pyexcel.sheet
在矩阵之上构建,添加命名列和行支持
8 pyexcel.book
book, fullname=pyexcel.book, file=pyexcel\book.py
pyexcel.book
Excel 工作簿
9 pyexcel.core
core, fullname=pyexcel.core, file=pyexcel\core.py
pyexcel.core
pyexcel签名函数列表
10 pyexcel.cookbook
cookbook, fullname=pyexcel.cookbook, file=pyexcel\cookbook.py
pyexcel.cookbook
Cookbook for pyexcel
11 pyexcel.deprecated
deprecated, fullname=pyexcel.deprecated, file=pyexcel\deprecated.py
pyexcel.deprecated
已弃用但为了向后兼容性而保留的api列表
函数
12 save_as(**keywords)
save_as(**keywords), module=pyexcel.core, line:67 at site-packages\pyexcel\core.py
将一个表从一个数据源保存到另一个数据源。
它接受两组关键字。为什么是两组?一组是源,另一组是目的。
为了区分这两个集合,源集将与:meth:`pyexcel.get_sheet`的源集完全相同。目标集与:class:`pyexcel.Sheet.save_as`中的目标集完全相同。
但需要一个'dest'前缀。
> 参见:DEST_PARAMS_TABLE
> 【pyexcel.docstrings.keywords】/常量/str/12 DEST_PARAMS_TABLE
> 参见:EXAMPLE_NOTE_PAGINATION
> 【pyexcel.docstrings.keywords】/常量/str/17 EXAMPLE_NOTE_PAGINATION
> 参见:SOURCE_PARAMS_TABLE
> 【pyexcel.docstrings.keywords】/常量/str/9 SOURCE_PARAMS_TABLE
**参数**
> 参见:FILE_PARAMS
> 【pyexcel.docstrings.keywords】/常量/str/5 FILE_PARAMS
session :> 参见:SOURCE_PARAMS
> 【pyexcel.docstrings.keywords】/常量/str/8 SOURCE_PARAMS
> 参见:PAGINATION_PARAMS
> 【pyexcel.docstrings.keywords】/常量/str/7 PAGINATION_PARAMS
> 参见:OPTIONAL_PARAMS
> 【pyexcel.docstrings.keywords】/常量/str/4 OPTIONAL_PARAMS
> 参见:** csv文件格式相关参数 **
> 【pyexcel.docstrings.keywords】/常量/str/1 CSV_PARAMS
> 参见:** xls文件格式相关参数 :**
> 【pyexcel.docstrings.keywords】/常量/str/2 XLRD_PARAMS
> 参见:DEST_PARAMS
> 【pyexcel.docstrings.keywords】/常量/str/11 DEST_PARAMS
如果 csv 文件是目标格式,那么 python csv `fmtparams <[参数](https://docs.python.org/release/3.1.5/library/csv.html#dialects-and-formatting-parameters)>` 被接受。
例如:dest_lineterminator 将把 default ‘ ’ 替换为您指定的值。
此外,这个函数使用:class:`pyexcel.Sheet` 以呈现可能有性能损失的数据。
作为交换,:class:`pyexcel.Sheet` 可以传递下去,例如: `name_columns_by_row` 。
13 get_book(**keywords)
get_book(**keywords), module=pyexcel.core, line:42 at site-packages\pyexcel\core.py
从excel源代码中获取一个类 :class:`Book` 的实例。
> 参见:SOURCE_BOOK_PARAMS_TABLE
> 【pyexcel.docstrings.keywords】/常量/str/15 SOURCE_BOOK_PARAMS_TABLE
**参数**
> 参见:FILE_PARAMS
> 【pyexcel.docstrings.keywords】/常量/str/5 FILE_PARAMS
> 参见:SOURCE_BOOK_PARAMS
> 【pyexcel.docstrings.keywords】/常量/str/14 SOURCE_BOOK_PARAMS
sheets: 要读取的混合表名称和表索引的列表。这样做是为了保持Pandas的紧致性。
使用此参数,可以读取多个工作表,并且可以控制读取感兴趣的工作表,而不是所有可用的工作表。
> 参见:OPTIONAL_PARAMS
> 【pyexcel.docstrings.keywords】/常量/str/4 OPTIONAL_PARAMS
> 参见:** csv文件格式相关参数 **
> 【pyexcel.docstrings.keywords】/常量/str/1 CSV_PARAMS
14 get_dict(name_columns_by_row=0, **keywords)
get_dict(name_columns_by_row=0, **keywords), module=pyexcel.core, line:141 at site-packages\pyexcel\core.py
从excel源获取字典
它接受与:meth:`~pyexcel.get_sheet`相同的参数,但是返回一个字典。
具体地说:
name_columns_by_row : 指定一行作为字典键。
默认为0或第一行。
如果你想使用列索引0,你应该这样做:
get_dict(name_columns_by_row=-1, name_rows_by_column=0)
> 参见:EXAMPLE_NOTE_PAGINATION
> 【pyexcel.docstrings.keywords】/常量/str/17 EXAMPLE_NOTE_PAGINATION
> 参见:SOURCE_PARAMS_TABLE
> 【pyexcel.docstrings.keywords】/常量/str/9 SOURCE_PARAMS_TABLE
**参数**
> 参见:FILE_PARAMS
> 【pyexcel.docstrings.keywords】/常量/str/5 FILE_PARAMS
> 参见:SOURCE_PARAMS
> 【pyexcel.docstrings.keywords】/常量/str/8 SOURCE_PARAMS
> 参见:PAGINATION_PARAMS
> 【pyexcel.docstrings.keywords】/常量/str/7 PAGINATION_PARAMS
> 参见:OPTIONAL_PARAMS
> 【pyexcel.docstrings.keywords】/常量/str/4 OPTIONAL_PARAMS
> 参见:** csv文件格式相关参数 **
> 【pyexcel.docstrings.keywords】/常量/str/1 CSV_PARAMS
> 参见:** xls文件格式相关参数 :**
> 【pyexcel.docstrings.keywords】/常量/str/2 XLRD_PARAMS
encoding_override:
用于克服旧版本文件中缺失或错误的代码页信息。
formatting_info:
默认为False,这样可以节省内存。
当为True时,格式化信息将从电子表格文件中读取。这将提供所有单元格,包括空单元格和空白单元格。
每个单元格都有格式化信息。
ragged_rows:
默认值为False意味着所有行都用空单元格填充,以便所有行都具有与ncols中相同的大小。
True表示行末尾没有空单元格。
如果行大小相差很大,这可以节省大量内存。另请参阅row_len()方法。
15 isave_as(**keywords)
isave_as(**keywords), module=pyexcel.core, line:85 at site-packages\pyexcel\core.py
将一个表从一个数据源保存到另一个内存更少的数据源。
除非它不接受:class: ' pyexcel.Sheet '的参数。它写的时候也会读。
它接受两组关键字。为什么是两组?一组是源,另一组是目的。
为了区分这两个集合,源集将与:meth:`pyexcel.get_sheet`的源集完全相同;目标集与:class:`pyexcel.Sheet.save_as` 中的目标集完全相同。
但是需要一个“dest”前缀。
> 参见:DEST_PARAMS_TABLE
> 【pyexcel.docstrings.keywords】/常量/str/12 DEST_PARAMS_TABLE
> 参见:EXAMPLE_NOTE_PAGINATION
> 【pyexcel.docstrings.keywords】/常量/str/17 EXAMPLE_NOTE_PAGINATION
> 参见:SOURCE_PARAMS_TABLE
> 【pyexcel.docstrings.keywords】/常量/str/9 SOURCE_PARAMS_TABLE
**参数**
> 参见:FILE_PARAMS
> 【pyexcel.docstrings.keywords】/常量/str/5 FILE_PARAMS
> 参见:SOURCE_PARAMS
> 【pyexcel.docstrings.keywords】/常量/str/8 SOURCE_PARAMS
> 参见:PAGINATION_PARAMS
> 【pyexcel.docstrings.keywords】/常量/str/7 PAGINATION_PARAMS
> 参见:OPTIONAL_PARAMS
> 【pyexcel.docstrings.keywords】/常量/str/4 OPTIONAL_PARAMS
> 参见:** csv文件格式相关参数 **
> 【pyexcel.docstrings.keywords】/常量/str/1 CSV_PARAMS
> 参见:** xls文件格式相关参数 :**
> 【pyexcel.docstrings.keywords】/常量/str/2 XLRD_PARAMS
> 参见:DEST_PARAMS
> 【pyexcel.docstrings.keywords】/常量/str/11 DEST_PARAMS
如果 csv 文件是目标格式,那么 python csv `fmtparams <[参数](https://docs.python.org/release/3.1.5/library/csv.html#dialects-and-formatting-parameters)>` 被接受。
例如:dest_lineterminator 将把 default ‘ ’ 替换为您指定的值。
此外,这个函数使用:class:`pyexcel.Sheet` 以呈现可能有性能损失的数据。
作为交换,:class:`pyexcel.Sheet` 可以传递下去,例如: `name_columns_by_row` 。
当使用此函数处理物理文件时,此函数将使其文件句柄保持打开状态。
当你完成对其数据的操作时,你需要调用:func: 'pyexcel.free_resources'来关闭文件hande。
> 参见:I_NOTE
> 【pyexcel.docstrings.keywords】/常量/str/16 I_NOTE
16 get_array(**keywords)
get_array(**keywords), module=pyexcel.core, line:129 at site-packages\pyexcel\core.py
从excel源代码中获取一个数组
它接受与:meth:`~pyexcel.get_sheet`相同的参数
而是返回一个数组。
> 参见:SOURCE_PARAMS_TABLE
> 【pyexcel.docstrings.keywords】/常量/str/9 SOURCE_PARAMS_TABLE
**参数**
> 参见:FILE_PARAMS
> 【pyexcel.docstrings.keywords】/常量/str/5 FILE_PARAMS
> 参见:SOURCE_PARAMS
> 【pyexcel.docstrings.keywords】/常量/str/8 SOURCE_PARAMS
> 参见:PAGINATION_PARAMS
> 【pyexcel.docstrings.keywords】/常量/str/7 PAGINATION_PARAMS
> 参见:OPTIONAL_PARAMS
> 【pyexcel.docstrings.keywords】/常量/str/4 OPTIONAL_PARAMS
> 参见:** csv文件格式相关参数 **
> 【pyexcel.docstrings.keywords】/常量/str/1 CSV_PARAMS
> 参见:** xls文件格式相关参数 :**
> 【pyexcel.docstrings.keywords】/常量/str/2 XLRD_PARAMS
17 get_sheet(**keywords)
get_sheet(**keywords), module=pyexcel.core, line:28 at site-packages\pyexcel\core.py
从excel源代码中获取:class: ' Sheet '的实例
> 参见:EXAMPLE_NOTE_PAGINATION
> 【pyexcel.docstrings.keywords】/常量/str/17 EXAMPLE_NOTE_PAGINATION
> 参见:SOURCE_PARAMS_TABLE
> 【pyexcel.docstrings.keywords】/常量/str/9 SOURCE_PARAMS_TABLE
**参数**
> 参见:FILE_PARAMS
> 【pyexcel.docstrings.keywords】/常量/str/5 FILE_PARAMS
> 参见:SOURCE_PARAMS
> 【pyexcel.docstrings.keywords】/常量/str/8 SOURCE_PARAMS
> 参见:PAGINATION_PARAMS
> 【pyexcel.docstrings.keywords】/常量/str/7 PAGINATION_PARAMS
> 参见:OPTIONAL_PARAMS
> 【pyexcel.docstrings.keywords】/常量/str/4 OPTIONAL_PARAMS
> 参见:** csv文件格式相关参数 **
> 【pyexcel.docstrings.keywords】/常量/str/1 CSV_PARAMS
> 参见:** xls文件格式相关参数 :**
> 【pyexcel.docstrings.keywords】/常量/str/2 XLRD_PARAMS
18 iget_book(**keywords)
iget_book(**keywords), module=pyexcel.core, line:56 at site-packages\pyexcel\core.py
第一个用例是在不将表提取到内存的情况下获取所有表的名称。
> 参见:SOURCE_BOOK_PARAMS_TABLE
> 【pyexcel.docstrings.keywords】/常量/str/15 SOURCE_BOOK_PARAMS_TABLE
**参数**
> 参见:FILE_PARAMS
> 【pyexcel.docstrings.keywords】/常量/str/5 FILE_PARAMS
> 参见:SOURCE_PARAMS
> 【pyexcel.docstrings.keywords】/常量/str/8 SOURCE_PARAMS
> 参见:PAGINATION_PARAMS
> 【pyexcel.docstrings.keywords】/常量/str/7 PAGINATION_PARAMS
> 参见:OPTIONAL_PARAMS
> 【pyexcel.docstrings.keywords】/常量/str/4 OPTIONAL_PARAMS
> 参见:** csv文件格式相关参数 **
> 【pyexcel.docstrings.keywords】/常量/str/1 CSV_PARAMS
当使用此函数处理物理文件时,此函数将使其文件句柄保持打开状态。
当你完成对其数据的操作时,你需要调用:func: 'pyexcel.free_resources'来关闭文件hande。
> 参见:I_NOTE
> 【pyexcel.docstrings.keywords】/常量/str/16 I_NOTE
19 iget_array(**keywords)
iget_array(**keywords), module=pyexcel.core, line:183 at site-packages\pyexcel\core.py
从excel源代码中获取一个二维数组的生成器
它类似于:meth:`pyexcel.Get_array '但是它的内存更少足迹。
> 参见:SOURCE_PARAMS_TABLE
> 【pyexcel.docstrings.keywords】/常量/str/9 SOURCE_PARAMS_TABLE
**参数**
> 参见:FILE_PARAMS
> 【pyexcel.docstrings.keywords】/常量/str/5 FILE_PARAMS
> 参见:SOURCE_BOOK_PARAMS
> 【pyexcel.docstrings.keywords】/常量/str/14 SOURCE_BOOK_PARAMS
sheets: 要读取的混合表名称和表索引的列表。这样做是为了保持Pandas的紧致性。
使用此参数,可以读取多个工作表,并且可以控制读取感兴趣的工作表,而不是所有可用的工作表。
> 参见:OPTIONAL_PARAMS
> 【pyexcel.docstrings.keywords】/常量/str/4 OPTIONAL_PARAMS
> 参见:** csv文件格式相关参数 **
> 【pyexcel.docstrings.keywords】/常量/str/1 CSV_PARAMS
> 参见:** xls文件格式相关参数 :**
> 【pyexcel.docstrings.keywords】/常量/str/2 XLRD_PARAMS
当使用此函数处理物理文件时,此函数将使其文件句柄保持打开状态。
当你完成对其数据的操作时,你需要调用:func: 'pyexcel.free_resources'来关闭文件hande。
> 参见:I_NOTE
> 【pyexcel.docstrings.keywords】/常量/str/16 I_NOTE
20 get_records(name_columns_by_row=0, **keywords)
get_records(name_columns_by_row=0, **keywords), module=pyexcel.core, line:162 at site-packages\pyexcel\core.py
从excel源获取字典
它接受与:meth:`~pyexcel.get_sheet`相同的参数,但是返回一个字典。
具体地说:
name_columns_by_row : 指定一行作为字典键。
默认为0或第一行。
如果你想使用列索引0,你应该这样做:
get_dict(name_columns_by_row=-1, name_rows_by_column=0)
> 参见:EXAMPLE_NOTE_PAGINATION
> 【pyexcel.docstrings.keywords】/常量/str/17 EXAMPLE_NOTE_PAGINATION
> 参见:SOURCE_PARAMS_TABLE
> 【pyexcel.docstrings.keywords】/常量/str/9 SOURCE_PARAMS_TABLE
**参数**
> 参见:FILE_PARAMS
> 【pyexcel.docstrings.keywords】/常量/str/5 FILE_PARAMS
> 参见:SOURCE_BOOK_PARAMS
> 【pyexcel.docstrings.keywords】/常量/str/14 SOURCE_BOOK_PARAMS
sheets: 要读取的混合表名称和表索引的列表。这样做是为了保持Pandas的紧致性。
使用此参数,可以读取多个工作表,并且可以控制读取感兴趣的工作表,而不是所有可用的工作表。
> 参见:OPTIONAL_PARAMS
> 【pyexcel.docstrings.keywords】/常量/str/4 OPTIONAL_PARAMS
> 参见:** csv文件格式相关参数 **
> 【pyexcel.docstrings.keywords】/常量/str/1 CSV_PARAMS
> 参见:** xls文件格式相关参数 :**
> 【pyexcel.docstrings.keywords】/常量/str/2 XLRD_PARAMS
encoding_override:
用于克服旧版本文件中缺失或错误的代码页信息。
formatting_info:
默认为False,这样可以节省内存。
当为True时,格式化信息将从电子表格文件中读取。这将提供所有单元格,包括空单元格和空白单元格。
每个单元格都有格式化信息。
ragged_rows:
默认值为False意味着所有行都用空单元格填充,以便所有行都具有与ncols中相同的大小。
True表示行末尾没有空单元格。
如果行大小相差很大,这可以节省大量内存。另请参阅row_len()方法。
21 iget_records(custom_headers=None, **keywords)
iget_records(custom_headers=None, **keywords), module=pyexcel.core, line:195 at site-packages\pyexcel\core.py
从excel源获取记录列表的生成器
它类似于:meth:`pyexcel.Get_records ',但它占用的内存较少,但要求头文件位于第一行。
数据矩阵的长度应该相等。它应该消耗更少的内存,并且应该能够很好地处理大文件。
> 参见:EXAMPLE_NOTE_PAGINATION
> 【pyexcel.docstrings.keywords】/常量/str/17 EXAMPLE_NOTE_PAGINATION
> 参见:SOURCE_PARAMS_TABLE
> 【pyexcel.docstrings.keywords】/常量/str/9 SOURCE_PARAMS_TABLE
**参数**
> 参见:FILE_PARAMS
> 【pyexcel.docstrings.keywords】/常量/str/5 FILE_PARAMS
> 参见:SOURCE_PARAMS
> 【pyexcel.docstrings.keywords】/常量/str/8 SOURCE_PARAMS
> 参见:PAGINATION_PARAMS
> 【pyexcel.docstrings.keywords】/常量/str/7 PAGINATION_PARAMS
> 参见:OPTIONAL_PARAMS
> 【pyexcel.docstrings.keywords】/常量/str/4 OPTIONAL_PARAMS
> 参见:** csv文件格式相关参数 **
> 【pyexcel.docstrings.keywords】/常量/str/1 CSV_PARAMS
> 参见:** xls文件格式相关参数 :**
> 【pyexcel.docstrings.keywords】/常量/str/2 XLRD_PARAMS
encoding_override:
用于克服旧版本文件中缺失或错误的代码页信息。
formatting_info:
默认为False,这样可以节省内存。
当为True时,格式化信息将从电子表格文件中读取。这将提供所有单元格,包括空单元格和空白单元格。
每个单元格都有格式化信息。
ragged_rows:
默认值为False意味着所有行都用空单元格填充,以便所有行都具有与ncols中相同的大小。
True表示行末尾没有空单元格。
如果行大小相差很大,这可以节省大量内存。另请参阅row_len()方法。
当使用此函数处理物理文件时,此函数将使其文件句柄保持打开状态。
当你完成对其数据的操作时,你需要调用:func: 'pyexcel.free_resources'来关闭文件hande。
> 参见:I_NOTE
> 【pyexcel.docstrings.keywords】/常量/str/16 I_NOTE
22 save_book_as(**keywords)
save_book_as(**keywords), module=pyexcel.core, line:104 at site-packages\pyexcel\core.py
将一本书从一个数据源保存到另一个数据源
> 参见:SOURCE_BOOK_PARAMS_TABLE
> 【pyexcel.docstrings.keywords】/常量/str/15 SOURCE_BOOK_PARAMS_TABLE
**参数**
> 参见:FILE_PARAMS
> 【pyexcel.docstrings.keywords】/常量/str/5 FILE_PARAMS
> 参见:SOURCE_BOOK_PARAMS
> 【pyexcel.docstrings.keywords】/常量/str/14 SOURCE_BOOK_PARAMS
sheets: 要读取的混合表名称和表索引的列表。这样做是为了保持Pandas的紧致性。
使用此参数,可以读取多个工作表,并且可以控制读取感兴趣的工作表,而不是所有可用的工作表。
> 参见:OPTIONAL_PARAMS
> 【pyexcel.docstrings.keywords】/常量/str/4 OPTIONAL_PARAMS
> 参见:** csv文件格式相关参数 **
> 【pyexcel.docstrings.keywords】/常量/str/1 CSV_PARAMS
dest_file_name: 另一个文件名。
dest_file_type: 如果您想保存到内存,这是必需的
dest_session : 目标数据库会话
dest_tables : 目标目标表的列表
dest_models : django的目标模型列表
dest_mapdicts : 映射字典的列表
dest_initializers : 表初始化函数
dest_mapdicts : 指定一个模型或表字段。可选
dest_batch_size : 批量创建大小。可选
其中字典应该有文本作为键,二维数组作为值。
================ ============================================
Saving to source parameters
================ ============================================
file dest_file_name, dest_sheet_name,
keywords with prefix 'dest'
memory dest_file_type, dest_content,
dest_sheet_name, keywords with prefix 'dest'
sql dest_session, dest_tables,
dest_table_init_func, dest_mapdict
django model dest_models, dest_initializers,
dest_mapdict, dest_batch_size
================ ============================================
23 get_book_dict(**keywords)
get_book_dict(**keywords), module=pyexcel.core, line:227 at site-packages\pyexcel\core.py
获取二维数组的字典
它接受与:meth:`~pyexcel.get_book`相同的参数
而是返回一个字典。
> 参见:SOURCE_BOOK_PARAMS_TABLE
> 【pyexcel.docstrings.keywords】/常量/str/15 SOURCE_BOOK_PARAMS_TABLE
**参数**
> 参见:FILE_PARAMS
> 【pyexcel.docstrings.keywords】/常量/str/5 FILE_PARAMS
> 参见:SOURCE_BOOK_PARAMS
> 【pyexcel.docstrings.keywords】/常量/str/14 SOURCE_BOOK_PARAMS
sheets: 要读取的混合表名称和表索引的列表。这样做是为了保持Pandas的紧致性。
使用此参数,可以读取多个工作表,并且可以控制读取感兴趣的工作表,而不是所有可用的工作表。
> 参见:OPTIONAL_PARAMS
> 【pyexcel.docstrings.keywords】/常量/str/4 OPTIONAL_PARAMS
> 参见:** csv文件格式相关参数 **
> 【pyexcel.docstrings.keywords】/常量/str/1 CSV_PARAMS
24 isave_book_as(**keywords)
isave_book_as(**keywords), module=pyexcel.core, line:115 at site-packages\pyexcel\core.py
将一工作簿从一个数据源保存到另一个数据源。
它类似于:meth:`pyexcel.save_book_as`,但它在写时读入。这个函数提供了一些加速,但输出数据并不统一。
这里有一个参数表:
========================== ===============================
源 参数:
========================== ===============================
loading from file file_name, keywords
loading from string file_content, file_type, keywords
loading from stream file_stream, file_type, keywords
loading from sql session, tables
loading from django models models
loading from dictionary bookdict
loading from an url url
========================== ===============================
其中字典应该有文本作为键,二维数组作为值。
**参数**
> 参见:FILE_PARAMS
> 【pyexcel.docstrings.keywords】/常量/str/5 FILE_PARAMS
> 参见:SOURCE_BOOK_PARAMS
> 【pyexcel.docstrings.keywords】/常量/str/14 SOURCE_BOOK_PARAMS
sheets: 要读取的混合表名称和表索引的列表。这样做是为了保持Pandas的紧致性。
使用此参数,可以读取多个工作表,并且可以控制读取感兴趣的工作表,而不是所有可用的工作表。
> 参见:OPTIONAL_PARAMS
> 【pyexcel.docstrings.keywords】/常量/str/4 OPTIONAL_PARAMS
> 参见:** csv文件格式相关参数 **
> 【pyexcel.docstrings.keywords】/常量/str/1 CSV_PARAMS
dest_file_name: 另一个文件名。
dest_file_type: 如果您想保存到内存,这是必需的
dest_session : 目标数据库会话
dest_tables : 目标目标表的列表
dest_models : django的目标模型列表
dest_mapdicts : 映射字典的列表
dest_initializers : 表初始化函数
dest_mapdicts : 指定一个模型或表字段。可选
dest_batch_size : 批量创建大小。可选
其中字典应该有文本作为键,二维数组作为值。
================ ============================================
Saving to source parameters
================ ============================================
file dest_file_name, dest_sheet_name,
keywords with prefix 'dest'
memory dest_file_type, dest_content,
dest_sheet_name, keywords with prefix 'dest'
sql dest_session, dest_tables,
dest_table_init_func, dest_mapdict
django model dest_models, dest_initializers,
dest_mapdict, dest_batch_size
================ ============================================
当使用此函数处理物理文件时,此函数将使其文件句柄打开。
当你完成操作时在它的数据上,你需要调用:func: ' pyexcel.free_resources '来关闭文件hande。
对于csv, csvz文件格式,文件句柄将保持打开状态。
对于xls、ods文件格式,文件将全部读入内存,然后关闭。
对于xlsx,文件句柄在python 2.7 - 3.5中通过pyexcel-xlsx(openpyxl)保持打开状态。
换句话说,pyexcel-xls、pyexcel-ods、pyexcel-ods3不会泄露文件句柄。
25 split_a_book(file_name, outfilename=None)
split_a_book(file_name, outfilename=None), module=pyexcel.cookbook, line:151 at site-packages\pyexcel\cookbook.py
将文件分割为单独的表
:param str file_name: 可访问的文件名
:param str outfilename: 以文件后缀保存文件
26 merge_all_to_a_book(filelist, outfilename=‘merged.xls’)
merge_all_to_a_book(filelist, outfilename=‘merged.xls’), module=pyexcel.cookbook, line:139 at site-packages\pyexcel\cookbook.py
将excel文件列表合并为excel book
:param list filelist: 可访问文件路径列表
:param str outfilename: 将表保存为
27 merge_csv_to_a_book(filelist, outfilename=‘merged.xls’)
merge_csv_to_a_book(filelist, outfilename=‘merged.xls’), module=pyexcel.cookbook, line:124 at site-packages\pyexcel\cookbook.py
将CSV文件列表合并为excel book
:param list filelist: 可访问文件路径列表
:param str outfilename: 将表保存为
28 extract_a_sheet_from_a_book(file_name, sheetname, outfilename=None)
extract_a_sheet_from_a_book(file_name, sheetname, outfilename=None), module=pyexcel.cookbook, line:167 at site-packages\pyexcel\cookbook.py
从excel工作簿中提取表格
:param str file_name: 一个可访问的文件名
:param str sheetname: 一个有效的表格名称
:param str outfilename: 保存表格为
29 inner(*arg, **keywords)
inner(*arg, **keywords), module=pyexcel._compact, line:60 at site-packages\pyexcel_compact.py
打印已废弃的消息
39 free_resources()
free_resources(), module=pyexcel.internal.garbagecollector, line:24 at site-packages\pyexcel\internal\garbagecollector.py
关闭以'i'开头的签名函数打开的文件句柄。
> 参见:I_NOTE
> 【pyexcel.docstrings.keywords】/常量/str/16 I_NOTE
类
40 pyexcel.book.Book
Book, pyexcel.book.Book, module=pyexcel.book, line:18 at site-packages\pyexcel\book.py
读取有一张或多张表格的excel工作工作簿。
对于csv文件,将只有一个表格。
method
1 init(self, sheets=None, filename=“memory”, path=None)
kind=method class=Book objtype=function line:42 at …\lib\site-packages\pyexcel\book.py
独立的函数,这样它就可以被多次调用
2 load_from_sheets(self, sheets)
kind=method class=Book objtype=function line:48 at …\lib\site-packages\pyexcel\book.py
从现有的工作表中加载内容
:param dict sheets: 工作表字典。每张表都是列表的列表
3 number_of_sheets(self)
kind=method class=Book objtype=function line:81 at …\lib\site-packages\pyexcel\book.py
返回表的数量
4 remove_sheet(self, sheet)
kind=method class=Book objtype=function line:107 at …\lib\site-packages\pyexcel\book.py
移开表单
5 sheet_by_index(self, index)
kind=method class=Book objtype=function line:99 at …\lib\site-packages\pyexcel\book.py
获取具有指定索引的表
6 sheet_by_name(self, name)
kind=method class=Book objtype=function line:93 at …\lib\site-packages\pyexcel\book.py
获取具有指定名称的工作表
7 sheet_names(self)
kind=method class=Book objtype=function line:87 at …\lib\site-packages\pyexcel\book.py
返回所有表名
8 sort_sheets(self, key=None, reverse=False)
kind=method class=Book objtype=function line:78 at …\lib\site-packages\pyexcel\book.py
9 to_dict(self)
kind=method class=Book objtype=function line:211 at …\lib\site-packages\pyexcel\book.py
把工作簿改成词典
41 pyexcel.sheet.Sheet
Sheet, pyexcel.sheet.Sheet, module=pyexcel.sheet, line:21 at site-packages\pyexcel\sheet.py
用于过滤、格式化和迭代的二维数据容器。
:class:`~pyexcel.Sheet` 是一个二维数组的容器,其中单个单元格可以是任何Python类型。
除了数字,这些类型的值:字符串,日期,时间和布尔值可以混合在数组中。这与Numpy的矩阵不同,Numpy的矩阵中每个单元格都是相同的数字类型。
为了为计算准备二维数据,格式化函数有助于将数组单元格转换为所需的类型。
格式化不仅可以应用于整个工作表,还可以应用于选定的行或列。自定义转换函数可以传递给这些格式化函数。
例如,要删除单元格内容周围的额外空格,就需要一个自定义函数。过滤函数用于减少数组中包含的信息。
:ivar name: 表名。使用更改表名
:ivar row: 逐行访问数据
:ivar column: 逐列访问数据
例子:
>>> import pyexcel as p
>>> content = {'A': [[1]]}
>>> b = p.get_book(bookdict=content)
>>> b
A:
+---+
| 1 |
+---+
>>> b[0].name
'A'
>>> b[0].name = 'B'
>>> b
B:
+---+
| 1 |
+---+
property
1 colnames=<property object at 0x0000000003A43228> kind:property type:property class:<class ‘pyexcel.sheet.Sheet’>
2 content=<property object at 0x0000000003A431D8> kind:property type:property class:<class ‘pyexcel.sheet.Sheet’>
3 rownames=<property object at 0x0000000003A43BD8> kind:property type:property class:<class ‘pyexcel.sheet.Sheet’>
method
4 clone(self)
kind=method class=Sheet objtype=function line:167 at …\lib\site-packages\pyexcel\sheet.py
5 delete_columns(self, column_indices)
kind=method class=Sheet objtype=function line:314 at …\lib\site-packages\pyexcel\sheet.py
删除一个或多个列 :param list column_indices: 列索引列表
6 delete_named_column_at(self, name)
kind=method class=Sheet objtype=function line:342 at …\lib\site-packages\pyexcel\sheet.py
仅在按给定名称命名列后生效,以标识列索引,将列设置为给定数组(列名除外)。
:param str name:列的名称
7 delete_named_row_at(self, name)
kind=method class=Sheet objtype=function line:377 at …\lib\site-packages\pyexcel\sheet.py
以第一列为行名给定名称来标识行索引,将行设置为给定数组(除了行名)。
8 delete_rows(self, row_indices)
kind=method class=Sheet objtype=function line:328 at …\lib\site-packages\pyexcel\sheet.py
删除一行或多行 :param list row_indices: 行索引列表
9 extend_columns(self, columns)
kind=method class=Sheet objtype=function line:418 at …\lib\site-packages\pyexcel\sheet.py
使用ordereddict扩展命名列:param ordereddist/list columns:列的列表
10 extend_columns_with_rows(self, rows)
kind=method class=Sheet objtype=function line:411 at …\lib\site-packages\pyexcel\sheet.py
将行放在数据的最右边
11 extend_rows(self, rows)
kind=method class=Sheet objtype=function line:392 at …\lib\site-packages\pyexcel\sheet.py
使用ordereddict扩展命名行:param ordereddist/list rows:行列表。
12 group_rows_by_column(self, column_index_or_name)
kind=method class=Sheet objtype=function line:205 at …\lib\site-packages\pyexcel\sheet.py
将具有相似列的行分组为二维数组。
例子:
>>> import pyexcel as p
>>> sample_data = [
... ["22/09/2017", "morning"],
... ["22/09/2017", "afternoon"],
... ["23/09/2017", "morning"],
... ["23/09/2017", "afternoon"]
... ]
>>> sheet = p.Sheet(sample_data)
>>> sheet.group_rows_by_column(0)
22/09/2017:
+------------+-----------+
| 22/09/2017 | morning |
+------------+-----------+
| 22/09/2017 | afternoon |
+------------+-----------+
23/09/2017:
+------------+-----------+
| 23/09/2017 | morning |
+------------+-----------+
| 23/09/2017 | afternoon |
+------------+-----------+
:returns: 工作簿的一个实例。
13 init()
kind=method class=Sheet objtype=function line:99 at …\lib\site-packages\pyexcel\sheet.py
用户初始化函数。
例子::
>>> import pyexcel as pe
>>> data = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
>>> sheet = pe.Sheet(data)
>>> sheet.row[1]
[4, 5, 6]
>>> sheet.row[0:3]
[[1, 2, 3], [4, 5, 6], [7, 8, 9]]
>>> sheet.row += [11, 12, 13]
>>> sheet.row[3]
[11, 12, 13]
>>> sheet.row[0:4] = [0, 0, 0] # set all to zero
>>> sheet.row[3]
[0, 0, 0]
>>> sheet.row[0] = ['a', 'b', 'c'] # set one row
>>> sheet.row[0]
['a', 'b', 'c']
>>> del sheet.row[0] # delete first row
>>> sheet.row[0] # now, second row becomes the first
[0, 0, 0]
>>> del sheet.row[0:]
>>> sheet.row[0] # nothing left
Traceback (most recent call last):
...
IndexError
14 name_columns_by_row(self, row_index)
kind=method class=Sheet objtype=function line:185 at …\lib\site-packages\pyexcel\sheet.py
使用指定行的元素表示单独的列。指定的行将从数据中删除
:param row_index: 具有列名的行的索引
15 name_rows_by_column(self, column_index)
kind=method class=Sheet objtype=function line:195 at …\lib\site-packages\pyexcel\sheet.py
使用指定列的元素表示单独的行。指定的列将从数据中删除
:param column_index: 具有行名的列的索引
16 named_column_at(self, name)
kind=method class=Sheet objtype=function line:294 at …\lib\site-packages\pyexcel\sheet.py
根据列的名称获取列
17 named_columns(self)
kind=method class=Sheet objtype=function line:565 at …\lib\site-packages\pyexcel\sheet.py
使用列名迭代行
18 named_row_at(self, name)
kind=method class=Sheet objtype=function line:358 at …\lib\site-packages\pyexcel\sheet.py
根据行名称获取行
19 named_rows(self)
kind=method class=Sheet objtype=function line:557 at …\lib\site-packages\pyexcel\sheet.py
使用行名迭代行
20 project(self, new_ordered_columns, exclusion=False)
kind=method class=Sheet objtype=function line:482 at …\lib\site-packages\pyexcel\sheet.py
重新排列表单。
:ivar new_ordered_columns: 新列。
:ivar exclusion: 是否排除指定列。默认为False
例子:
>>> sheet = Sheet(
... [["A", "B", "C"], [1, 2, 3], [11, 22, 33], [111, 222, 333]],
... name_columns_by_row=0)
>>> sheet.project(["B", "A", "C"])
pyexcel sheet:
+-----+-----+-----+
| B | A | C |
+=====+=====+=====+
| 2 | 1 | 3 |
+-----+-----+-----+
| 22 | 11 | 33 |
+-----+-----+-----+
| 222 | 111 | 333 |
+-----+-----+-----+
>>> sheet.project(["B", "C"])
pyexcel sheet:
+-----+-----+
| B | C |
+=====+=====+
| 2 | 3 |
+-----+-----+
| 22 | 33 |
+-----+-----+
| 222 | 333 |
+-----+-----+
>>> sheet.project(["B", "C"], exclusion=True)
pyexcel sheet:
+-----+
| A |
+=====+
| 1 |
+-----+
| 11 |
+-----+
| 111 |
+-----+
21 set_named_column_at(self, name, column_array)
kind=method class=Sheet objtype=function line:302 at …\lib\site-packages\pyexcel\sheet.py
以第一行为列名给定名称标识列索引,除列名外,将列设置为给定数组。
22 set_named_row_at(self, name, row_array)
kind=method class=Sheet objtype=function line:365 at …\lib\site-packages\pyexcel\sheet.py
以第一列为行名给定名称来标识行索引,将行设置为给定数组(除了行名)。
23 to_array(self)
kind=method class=Sheet objtype=function line:437 at …\lib\site-packages\pyexcel\sheet.py
返回过滤后的数组
24 to_dict(self, row=False)
kind=method class=Sheet objtype=function line:544 at …\lib\site-packages\pyexcel\sheet.py
返回字典
25 to_records(self, custom_headers=None)
kind=method class=Sheet objtype=function line:452 at …\lib\site-packages\pyexcel\sheet.py
它以第一行为键,其余行为值。
然后压缩每一行的键和行值。这对数据库操作特别有帮助。
26 top(self, lines=5)
kind=method class=Sheet objtype=function line:251 at …\lib\site-packages\pyexcel\sheet.py
预览顶部最多5行
27 top_left(self, rows=5, columns=5)
kind=method class=Sheet objtype=function line:260 at …\lib\site-packages\pyexcel\sheet.py
预览顶部角:5x5
28 transpose(self)
kind=method class=Sheet objtype=function line:178 at …\lib\site-packages\pyexcel\sheet.py
私有或局部
42 _compact <module ‘pyexcel._compact’ from ‘…\lib\site-packages\pyexcel\_compact.py’>
【pyexcel._compact】
_compact, fullname=pyexcel._compact, file=pyexcel_compact.py
【pyexcel.constants】
constants, fullname=pyexcel.constants, file=pyexcel\constants.py
【pyexcel.exceptions】
exceptions, fullname=pyexcel.exceptions, file=pyexcel\exceptions.py
【pyexcel.plugins】
plugins, fullname=pyexcel.plugins, file=pyexcel\plugins_init_.py
【pyexcel.docstrings】
docstrings, fullname=pyexcel.docstrings, file=pyexcel\docstrings_init_.py
【pyexcel.internal】
internal, fullname=pyexcel.internal, file=pyexcel\internal_init_.py
【pyexcel.sheet】
sheet, fullname=pyexcel.sheet, file=pyexcel\sheet.py
【pyexcel.book】
book, fullname=pyexcel.book, file=pyexcel\book.py
【pyexcel.core】
core, fullname=pyexcel.core, file=pyexcel\core.py
【pyexcel.cookbook】
cookbook, fullname=pyexcel.cookbook, file=pyexcel\cookbook.py
【pyexcel.deprecated】
deprecated, fullname=pyexcel.deprecated, file=pyexcel\deprecated.py
【sys】
sys, fullname=sys, file=
【warnings】
warnings, fullname=warnings, file=warnings.py
【urllib.request】
request, fullname=urllib.request, file=urllib\request.py
使用此模块最简单的方法是调用urlopen函数,该函数接受包含URL或Request对象的字符串(如下所述)。
统计
序号 | 类别 | 数量 |
---|---|---|
1 | int | 1 |
2 | bool | 1 |
4 | str | 6 |
6 | list | 2 |
8 | dict | 2 |
9 | module | 17 |
10 | class | 33 |
11 | function | 41 |
12 | builtin_function_or_method | 1 |
13 | residual | 8 |
14 | system | 10 |
15 | private | 12 |
16 | all | 112 |
常量
int
1 MAXFTPCACHE 10
bool
2 _have_ssl True
list
3 _url_tempfiles []
dict
4 ftpcache {}
模块
5 base64
base64, fullname=base64, file=base64.py
Base16, Base32, Base64 (RFC 3548), Base85和Ascii85数据编码
6 bisect
bisect, fullname=bisect, file=bisect.py
二分算法。
7 email
email, fullname=email, file=email_init_.py
用于解析、处理和生成电子邮件消息的包。
8 hashlib
hashlib, fullname=hashlib, file=hashlib.py
hashlib模块——许多哈希函数的公共接口。
9 http
http, fullname=http, file=http_init_.py
10 io
io, fullname=io, file=io.py
11 os
os, fullname=os, file=os.py
12 posixpath
posixpath, fullname=posixpath, file=posixpath.py
Posix路径名的常用操作。不要直接导入这个模块,而是导入os并将这个模块引用为os.path。
13 re
re, fullname=re, file=re.py
14 socket
socket, fullname=socket, file=socket.py
该模块提供套接字操作和一些相关功能。
15 string
string, fullname=string, file=string.py
字符串常量的集合。
16 sys
sys, fullname=sys, file=
17 time
time, fullname=time, file=
18 tempfile
tempfile, fullname=tempfile, file=tempfile.py
19 contextlib
contextlib, fullname=contextlib, file=contextlib.py
使用语句上下文的实用程序。参见PEP 343。
20 warnings
warnings, fullname=warnings, file=warnings.py
21 ssl
ssl, fullname=ssl, file=ssl.py
这个模块为SSL(证书)提供了更多的python支持。
函数
22 urlparse(url, scheme=‘’, allow_fragments=True)
urlparse(url, scheme=‘’, allow_fragments=True), module=urllib.parse, line:361 at urllib\parse.py
将URL解析为6个组件:<scheme>://<netloc>/<path>;<params>?<query>#<fragment>
返回6元组(scheme, netloc, path, params, query, fragment)。
注意,我们没有将组件分解成更小的位(例如,netloc是一个单独的字符串),并且我们没有展开 % escape编码。
23 urlsplit(url, scheme=‘’, allow_fragments=True)
urlsplit(url, scheme=‘’, allow_fragments=True), module=urllib.parse, line:412 at urllib\parse.py
将URL解析为5个组件:
<scheme>://<netloc>/<path>?<query>#<fragment>
返回5元组:(scheme, netloc, path, query, fragment).
注意,我们没有将组件分解成更小的位(例如,netloc是一个单独的字符串),并且我们没有展开% escapes。
24 urljoin(base, url, allow_fragments=True)
urljoin(base, url, allow_fragments=True), module=urllib.parse, line:499 at urllib\parse.py
连接一个基本URL和一个可能的相对URL,形成后者的绝对解释。
25 unwrap(url)
unwrap(url), module=urllib.parse, line:968 at urllib\parse.py
unwrap('<URL:type://host/path>') --> 'type://host/path'.
26 quote(string, safe=‘/’, encoding=None, errors=None)
quote(string, safe=‘/’, encoding=None, errors=None), module=urllib.parse, line:782 at urllib\parse.py
quote('abc def') -> 'abc%20def'
URL的每个部分,例如路径信息,查询等,都有一组必须引用的保留字符。
quote函数提供了一种谨慎的(不是最小的)方法来为大多数这些部分引用字符串。
RFC 3986 URI (Uniform Resource Identifier):通用语法列出了以下(un)保留字符。
unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
reserved = gen-delims / sub-delims
gen-delims = ":" / "/" / "?" / "#" / "[" / "]" / "@"
sub-delims = "!" / "$" / "&" / "'" / "(" / ")" / "*" / "+" / "," / ";" / "="
每个保留字符都保留在URL的某个组件中,但不一定保留在所有组件中。
引号函数%-转义所有既不在非保留字符(“始终安全”)中也不在通过安全参数设置的额外字符中的字符。
safe参数的默认值是'/'。字符是保留的,但在典型用法中,quote函数是在保留现有斜杠字符的路径上调用的。
Python 3.7从使用RFC 2396更新到RFC 3986来引用URL字符串。
现在,“~”包含在无保留字符集中。String和safe可以是STR或bytes对象。如果string是bytes对象,则Encoding和errors不能指定。
可选的encoding和errors参数指定如何处理str.encode方法所接受的非ascii字符。
默认情况下,encoding='utf-8'(字符用utf-8编码),errors='strict'(不支持的字符将引发UnicodeEncodeError)。
27 unquote(string, encoding=‘utf-8’, errors=‘replace’)
unquote(string, encoding=‘utf-8’, errors=‘replace’), module=urllib.parse, line:619 at urllib\parse.py
将%xx转义替换为对应的单字符。
可选的encoding和errors参数指定如何将百分比编码的序列解码为Unicode字符,这是bytes.decode()方法所接受的。
默认情况下,百分比编码的序列用UTF-8解码,无效的序列用占位符替换。
unquote('abc%20def') -> 'abc def'.
28 splittype(url)
splittype(url), module=urllib.parse, line:977 at urllib\parse.py
splittype('type:opaquestring') --> 'type', 'opaquestring'.
29 splithost(url)
splithost(url), module=urllib.parse, line:990 at urllib\parse.py
splithost('//host[:port]/path') --> 'host[:port]', '/path'.
30 splitport(host)
splitport(host), module=urllib.parse, line:1016 at urllib\parse.py
splitport('host:port') --> 'host', 'port'.
31 splituser(host)
splituser(host), module=urllib.parse, line:1004 at urllib\parse.py
splituser('user[:passwd]@host[:port]') --> 'user[:passwd]', 'host[:port]'.
32 splitpasswd(user)
splitpasswd(user), module=urllib.parse, line:1009 at urllib\parse.py
splitpasswd('user:passwd') -> 'user', 'passwd'.
33 splitattr(url)
splitattr(url), module=urllib.parse, line:1059 at urllib\parse.py
splitattr('/path;attr1=value1;attr2=value2;...') -> '/path', ['attr1=value1', 'attr2=value2', ...].
34 splitquery(url)
splitquery(url), module=urllib.parse, line:1045 at urllib\parse.py
splitquery('/path?query') --> '/path', 'query'.
35 splitvalue(attr)
splitvalue(attr), module=urllib.parse, line:1065 at urllib\parse.py
splitvalue('attr=value') --> 'attr', 'value'.
36 splittag(url)
splittag(url), module=urllib.parse, line:1052 at urllib\parse.py
splittag('/path#tag') --> '/path', 'tag'.
37 to_bytes(url)
to_bytes(url), module=urllib.parse, line:955 at urllib\parse.py
to_bytes(u"URL") --> 'URL'.
38 unquote_to_bytes(string)
unquote_to_bytes(string), module=urllib.parse, line:587 at urllib\parse.py
unquote_to_bytes('abc%20def') -> b'abc def'.
39 urlunparse(components)
urlunparse(components), module=urllib.parse, line:469 at urllib\parse.py
将解析后的URL重新组合在一起。
这可能会导致一个略有不同,但等效的URL,如果最初解析的URL有多余的分隔符,例如a ?使用空查询(草案声明它们是等效的)。
40 urlopen(url, data=None, timeout=<object object at 0x00000000003C7FD0>, *, cafile=None, capath=None, cadefault=False, context=None)
urlopen(url, data=None, timeout=<object object at 0x00000000003C7FD0>, *, cafile=None, capath=None, cadefault=False, context=None), module=urllib.request, line:139 at urllib\request.py
打开URL,它可以是字符串,也可以是Request对象。
*data*必须是一个对象,指定要发送到服务器的附加数据,如果不需要这些数据,则为None。
有关详细信息,请参见Request。
urllib.request模块使用HTTP/1.1,并在其HTTP请求中包含“Connection:close”报头。
可选的*timeout*参数指定阻止连接尝试等操作的超时时间(如果未指定,将使用全局默认超时设置)。
这只适用于HTTP, HTTPS和FTP连接。如果指定了*context*,则必须是ssl。
描述各种SSL选项的SSLContext实例。更多细节请参见 HTTPSConnection。
可选参数*cafile*和*capath*为HTTPS请求指定一组受信任的CA证书。
cafile应该指向一个包含一组CA证书的文件,而capath应该指向一个包含散列证书文件的目录。
更多信息可以在 ssl.SSLContext.load_verify_locations() 中找到。
*cadefault*参数将被忽略。此函数总是返回一个对象,该对象可以作为上下文管理器,并且具有方法,例如
* geturl() -返回检索到的资源的URL,通常用于确定是否遵循重定向
* info() -返回页面的元信息,如标题,以电子邮件的形式。email.message_from_string()(参见HTTP Headers快速参考)
* getcode() -返回响应的HTTP状态码。在错误时引发URLError。
对于HTTP和HTTPS url,该函数返回稍微修改过的 http.client.HTTPResponse 对象。
除了上述三个新方法之外,msg属性还包含与reason属性相同的信息——服务器返回的原因短语——而不是HTTPResponse文档中指定的响应头。
对于FTP、文件和数据url以及由遗留 URLopener和 FancyURLopener类显式处理的请求,该函数返回一个urllib.response.addinfourl对象。
注意,如果没有处理程序处理请求,则可能返回None(尽管默认安装的全局OpenerDirector使用UnknownHandler来确保这种情况不会发生)。
此外,如果检测到代理设置(例如,当设置了* proxy环境变量,如 http_proxy),ProxyHandler将默认安装,并确保通过代理处理请求。
41 install_opener(opener)
install_opener(opener), module=urllib.request, line:224 at urllib\request.py
42 urlretrieve(url, filename=None, reporthook=None, data=None)
urlretrieve(url, filename=None, reporthook=None, data=None), module=urllib.request, line:229 at urllib\request.py
检索URL到磁盘上的临时位置。
需要URL参数。如果传递了一个文件名,它将用作临时文件位置。
reportthook参数应该是一个可调用对象,它接受块号、读大小和URL目标的总文件大小。
data参数应该是有效的URL编码数据。如果传递了一个文件名,并且URL指向一个本地资源,则结果是从本地文件复制到新文件。
返回一个元组,其中包含新创建的数据文件的路径以及结果HTTPMessage对象。
43 urlcleanup()
urlcleanup(), module=urllib.request, line:292 at urllib\request.py
清理urlretrieve调用中的临时文件。
44 request_host(request)
request_host(request), module=urllib.request, line:307 at urllib\request.py
返回由RFC 2965定义的request-host。
Variation from RFC: 返回值小写,方便比较。
45 build_opener(*handlers)
build_opener(*handlers), module=urllib.request, line:575 at urllib\request.py
从处理程序列表中创建一个打开器对象。
该打开器将使用几个默认处理程序,包括支持HTTP, FTP和适用的HTTPS。
如果任何作为参数传递的处理程序是默认处理程序的子类,则不会使用默认处理程序。
46 _parse_proxy(proxy)
_parse_proxy(proxy), module=urllib.request, line:764 at urllib\request.py
给定URL或权限返回(方案、用户、密码、主机/端口)。
如果提供了一个URL,它必须有一个授权(host:port)组件。
根据RFC 3986,拥有一个授权组件意味着URL在方案之后必须有两个斜杠。
47 parse_keqv_list(l)
parse_keqv_list(l), module=urllib.request, line:1422 at urllib\request.py
解析key=value字符串列表,其中键不重复。
48 parse_http_list(s)
parse_http_list(s), module=urllib.request, line:1432 at urllib\request.py
按照RFC 2068章节2的描述解析列表。
特别是,解析逗号分隔的列表,其中列表元素可能包括带引号的字符串。
带引号的字符串可以包含逗号。不带引号的字符串中间可以有引号。
如果被转义,逗号和引号都不算数。只有双引号才算数,单引号不行。
49 _safe_gethostbyname(host)
_safe_gethostbyname(host), module=urllib.request, line:1526 at urllib\request.py
50 url2pathname(url)
url2pathname(url), module=nturl2path, line:8 at nturl2path.py
从'file'方案的相对URL到文件系统路径的特定于操作系统的转换;不建议一般使用。
51 pathname2url§
pathname2url§, module=nturl2path, line:45 at nturl2path.py
从文件系统路径到'file'方案的相对URL的特定于操作系统的转换;不建议一般使用。
52 localhost()
localhost(), module=urllib.request, line:2356 at urllib\request.py
返回魔法主机名‘localhost’的IP地址。
53 thishost()
thishost(), module=urllib.request, line:2364 at urllib\request.py
返回当前主机的IP地址。
54 ftperrors()
ftperrors(), module=urllib.request, line:2375 at urllib\request.py
返回由FTP类引发的错误集。
55 noheaders()
noheaders(), module=urllib.request, line:2384 at urllib\request.py
返回一个空的email Message对象。
56 getproxies_environment()
getproxies_environment(), module=urllib.request, line:2489 at urllib\request.py
返回scheme ->代理服务器URL映射的字典
。扫描环境中名为<scheme> proxy的变量;这似乎是标准的约定。
如果你需要一种不同的方法,你可以将一个代理字典传递给[Fancy]URLopener构造函数。
57 proxy_bypass_environment(host, proxies=None)
proxy_bypass_environment(host, proxies=None), module=urllib.request, line:2520 at urllib\request.py
测试代理是否不应该用于特定的主机。
检查代理字典中no_proxy的值,该值应该是一个由逗号分隔的DNS后缀组成的列表,或所有主机的“*”。
58 _proxy_bypass_macosx_sysconf(host, proxy_settings)
_proxy_bypass_macosx_sysconf(host, proxy_settings), module=urllib.request, line:2557 at urllib\request.py
如果该主机不应该通过代理访问,则返回True。
该函数使用MacOSX框架SystemConfiguration获取代理信息。
代理设置来自_scproxy._get_proxy_settings 或得到模拟,即:
{ 'exclude_simple': bool,
'exceptions': ['foo.bar', '*.bar.com', '127.0.0.1', '10.1', '10.0/16']
}
59 getproxies_registry()
getproxies_registry(), module=urllib.request, line:2652 at urllib\request.py
返回scheme ->代理服务器URL映射的字典。
Win32使用注册表来存储代理。
60 getproxies()
getproxies(), module=urllib.request, line:2697 at urllib\request.py
返回scheme ->代理服务器URL映射的字典。
返回从环境(如果指定)或注册中心收集的设置。
61 proxy_bypass_registry(host)
proxy_bypass_registry(host), module=urllib.request, line:2706 at urllib\request.py
62 proxy_bypass(host)
proxy_bypass(host), module=urllib.request, line:2756 at urllib\request.py
如果需要绕过host,则返回True。
检查从环境(如果指定)或注册中心收集的代理设置。
类
63 urllib.error.URLError
URLError, urllib.error.URLError, module=urllib.error, line:19 at urllib\error.py
64 urllib.error.HTTPError
HTTPError, urllib.error.HTTPError, module=urllib.error, line:35 at urllib\error.py
当HTTP错误发生时引发,但也像非错误返回一样
property
1 headers=<property object at 0x0000000003713A98> kind:property type:property class:<class ‘urllib.error.HTTPError’>
2 reason=<property object at 0x00000000037139A8> kind:property type:property class:<class ‘urllib.error.HTTPError’>
65 urllib.error.ContentTooShortError
ContentTooShortError, urllib.error.ContentTooShortError, module=urllib.error, line:73 at urllib\error.py
当下载的大小与内容长度不匹配时引发异常。
66 urllib.response.addinfourl
addinfourl, urllib.response.addinfourl, module=urllib.response, line:68 at urllib\response.py
类将info()和geturl()方法添加到打开的文件中。
method
1 getcode(self)
kind=method class=addinfourl objtype=function line:76 at …\lib\urllib\response.py
2 geturl(self)
kind=method class=addinfourl objtype=function line:79 at …\lib\urllib\response.py
67 urllib.response.addclosehook
addclosehook, urllib.response.addclosehook, module=urllib.response, line:37 at urllib\response.py
类将关闭钩子添加到打开的文件。
method
1 close(self)
kind=method class=addclosehook objtype=function line:45 at …\lib\urllib\response.py
68 urllib.request.Request
Request, urllib.request.Request, module=urllib.request, line:323 at urllib\request.py
property
1 data=<property object at 0x00000000036DA408> kind:property type:property class:<class ‘urllib.request.Request’>
2 full_url=<property object at 0x00000000036DA3B8> kind:property type:property class:<class ‘urllib.request.Request’>
method
3 add_header(self, key, val)
kind=method class=Request objtype=function line:407 at …\lib\urllib\request.py
4 add_unredirected_header(self, key, val)
kind=method class=Request objtype=function line:411 at …\lib\urllib\request.py
5 get_full_url(self)
kind=method class=Request objtype=function line:393 at …\lib\urllib\request.py
6 get_header(self, header_name, default=None)
kind=method class=Request objtype=function line:419 at …\lib\urllib\request.py
7 get_method(self)
kind=method class=Request objtype=function line:388 at …\lib\urllib\request.py
返回指示HTTP请求方法的字符串。
8 has_header(self, header_name)
kind=method class=Request objtype=function line:415 at …\lib\urllib\request.py
9 has_proxy(self)
kind=method class=Request objtype=function line:404 at …\lib\urllib\request.py
10 header_items(self)
kind=method class=Request objtype=function line:428 at …\lib\urllib\request.py
11 remove_header(self, header_name)
kind=method class=Request objtype=function line:424 at …\lib\urllib\request.py
12 set_proxy(self, host, type)
kind=method class=Request objtype=function line:396 at …\lib\urllib\request.py
69 urllib.request.OpenerDirector
OpenerDirector, urllib.request.OpenerDirector, module=urllib.request, line:433 at urllib\request.py
method
1 add_handler(self, handler)
kind=method class=OpenerDirector objtype=function line:445 at …\lib\urllib\request.py
2 close(self)
kind=method class=OpenerDirector objtype=function line:492 at …\lib\urllib\request.py
3 error(self, proto, *args)
kind=method class=OpenerDirector objtype=function line:550 at …\lib\urllib\request.py
4 open(self, fullurl, data=None, timeout=socket._GLOBAL_DEFAULT_TIMEOUT)
kind=method class=OpenerDirector objtype=function line:507 at …\lib\urllib\request.py
70 urllib.request.BaseHandler
BaseHandler, urllib.request.BaseHandler, module=urllib.request, line:611 at urllib\request.py
data
1 handler_order=500 kind:data type:int class:<class ‘urllib.request.BaseHandler’>
method
2 add_parent(self, parent)
kind=method class=BaseHandler objtype=function line:614 at …\lib\urllib\request.py
3 close(self)
kind=method class=BaseHandler objtype=function line:617 at …\lib\urllib\request.py
71 urllib.request.HTTPErrorProcessor
HTTPErrorProcessor, urllib.request.HTTPErrorProcessor, module=urllib.request, line:630 at urllib\request.py
处理HTTP错误响应。
data
1 handler_order=1000 kind:data type:int class:<class ‘urllib.request.HTTPErrorProcessor’>
method
2 http_response(self, request, response)
kind=method class=HTTPErrorProcessor objtype=function line:634 at …\lib\urllib\request.py
3 https_response()
kind=method class=HTTPErrorProcessor objtype=function
72 urllib.request.HTTPDefaultErrorHandler
HTTPDefaultErrorHandler, urllib.request.HTTPDefaultErrorHandler, module=urllib.request, line:647 at urllib\request.py
method
1 http_error_default(self, req, fp, code, msg, hdrs)
kind=method class=HTTPDefaultErrorHandler objtype=function line:648 at …\lib\urllib\request.py
73 urllib.request.HTTPRedirectHandler
HTTPRedirectHandler, urllib.request.HTTPRedirectHandler, module=urllib.request, line:651 at urllib\request.py
data
1 inf_msg=The HTTP server returned a redirect error that would lead to an infinite loop.
T… kind:data type:str class:<class ‘urllib.request.HTTPRedirectHandler’>
2 max_redirections=10 kind:data type:int class:<class ‘urllib.request.HTTPRedirectHandler’>
3 max_repeats=4 kind:data type:int class:<class ‘urllib.request.HTTPRedirectHandler’>
method
4 http_error_301(self, url, fp, errcode, errmsg, headers, data=None)
kind=method class=HTTPRedirectHandler objtype=function line:2200 at …\lib\urllib\request.py
5 http_error_302(self, req, fp, code, msg, headers)
kind=method class=HTTPRedirectHandler objtype=function line:697 at …\lib\urllib\request.py
6 http_error_303(self, url, fp, errcode, errmsg, headers, data=None)
kind=method class=HTTPRedirectHandler objtype=function line:2204 at …\lib\urllib\request.py
7 http_error_307(self, url, fp, errcode, errmsg, headers, data=None)
kind=method class=HTTPRedirectHandler objtype=function line:2208 at …\lib\urllib\request.py
8 redirect_request(self, req, fp, code, msg, headers, newurl)
kind=method class=HTTPRedirectHandler objtype=function line:659 at …\lib\urllib\request.py
返回Request或None以响应重定向。
当接收到重定向响应时,http_error_30x 方法将调用此方法。
如果需要重定向,则返回一个新的请求以允许http错误30x执行重定向。
否则,如果没有其他人尝试处理此url,则引发HTTPError。
如果不能返回None,但另一个Handler可能会返回None。
74 urllib.request.ProxyHandler
ProxyHandler, urllib.request.ProxyHandler, module=urllib.request, line:793 at urllib\request.py
data
1 handler_order=100 kind:data type:int class:<class ‘urllib.request.ProxyHandler’>
method
2 proxy_open(self, req, proxy, type)
kind=method class=ProxyHandler objtype=function line:807 at …\lib\urllib\request.py
75 urllib.request.HTTPPasswordMgr
HTTPPasswordMgr, urllib.request.HTTPPasswordMgr, module=urllib.request, line:835 at urllib\request.py
method
1 add_password(self, realm, uri, user, passwd)
kind=method class=HTTPPasswordMgr objtype=function line:840 at …\lib\urllib\request.py
2 find_user_password(self, realm, authuri)
kind=method class=HTTPPasswordMgr objtype=function line:851 at …\lib\urllib\request.py
3 is_suburi(self, base, test)
kind=method class=HTTPPasswordMgr objtype=function line:884 at …\lib\urllib\request.py
检查test在URI树中是否在基值以下。两个参数必须是简化形式的URI。
4 reduce_uri(self, uri, default_port=True)
kind=method class=HTTPPasswordMgr objtype=function line:861 at …\lib\urllib\request.py
接受权限或URI并只提取权限和路径。
76 urllib.request.HTTPPasswordMgrWithDefaultRealm
HTTPPasswordMgrWithDefaultRealm, urllib.request.HTTPPasswordMgrWithDefaultRealm, module=urllib.request, line:899 at urllib\request.py
method
1 find_user_password(self, realm, authuri)
kind=method class=HTTPPasswordMgrWithDefaultRealm objtype=function line:901 at …\lib\urllib\request.py
77 urllib.request.HTTPPasswordMgrWithPriorAuth
HTTPPasswordMgrWithPriorAuth, urllib.request.HTTPPasswordMgrWithPriorAuth, module=urllib.request, line:909 at urllib\request.py
method
1 add_password(self, realm, uri, user, passwd, is_authenticated=False)
kind=method class=HTTPPasswordMgrWithPriorAuth objtype=function line:915 at …\lib\urllib\request.py
2 is_authenticated(self, authuri)
kind=method class=HTTPPasswordMgrWithPriorAuth objtype=function line:932 at …\lib\urllib\request.py
3 update_authenticated(self, uri, is_authenticated=False)
kind=method class=HTTPPasswordMgrWithPriorAuth objtype=function line:922 at …\lib\urllib\request.py
78 urllib.request.AbstractBasicAuthHandler
AbstractBasicAuthHandler, urllib.request.AbstractBasicAuthHandler, module=urllib.request, line:940 at urllib\request.py
data
1 rx=re.compile(‘(?:^|,)[ \t]([^ \t]+)[ \t]+realm=([“']?)([^”'])\2’, re.IGNORECASE) kind:data type:Pattern class:<class ‘urllib.request.AbstractBasicAuthHandler’>
method
2 http_error_auth_reqed(self, authreq, host, req, headers)
kind=method class=AbstractBasicAuthHandler objtype=function line:987 at …\lib\urllib\request.py
3 http_request(self, req)
kind=method class=AbstractBasicAuthHandler objtype=function line:1025 at …\lib\urllib\request.py
4 http_response(self, req, response)
kind=method class=AbstractBasicAuthHandler objtype=function line:1038 at …\lib\urllib\request.py
5 https_request()
kind=method class=AbstractBasicAuthHandler objtype=function
6 https_response()
kind=method class=AbstractBasicAuthHandler objtype=function
7 retry_http_basic_auth(self, host, req, realm)
kind=method class=AbstractBasicAuthHandler objtype=function line:1013 at …\lib\urllib\request.py
79 urllib.request.HTTPBasicAuthHandler
HTTPBasicAuthHandler, urllib.request.HTTPBasicAuthHandler, module=urllib.request, line:1051 at urllib\request.py
data
1 auth_header=Authorization kind:data type:str class:<class ‘urllib.request.HTTPBasicAuthHandler’>
method
2 http_error_401(self, req, fp, code, msg, headers)
kind=method class=HTTPBasicAuthHandler objtype=function line:1055 at …\lib\urllib\request.py
80 urllib.request.ProxyBasicAuthHandler
ProxyBasicAuthHandler, urllib.request.ProxyBasicAuthHandler, module=urllib.request, line:1062 at urllib\request.py
data
1 auth_header=Proxy-authorization kind:data type:str class:<class ‘urllib.request.ProxyBasicAuthHandler’>
method
2 http_error_407(self, req, fp, code, msg, headers)
kind=method class=ProxyBasicAuthHandler objtype=function line:1066 at …\lib\urllib\request.py
81 urllib.request.AbstractDigestAuthHandler
AbstractDigestAuthHandler, urllib.request.AbstractDigestAuthHandler, module=urllib.request, line:1081 at urllib\request.py
method
1 get_algorithm_impls(self, algorithm)
kind=method class=AbstractDigestAuthHandler objtype=function line:1209 at …\lib\urllib\request.py
2 get_authorization(self, req, chal)
kind=method class=AbstractDigestAuthHandler objtype=function line:1147 at …\lib\urllib\request.py
3 get_cnonce(self, nonce)
kind=method class=AbstractDigestAuthHandler objtype=function line:1136 at …\lib\urllib\request.py
4 get_entity_digest(self, data, chal)
kind=method class=AbstractDigestAuthHandler objtype=function line:1222 at …\lib\urllib\request.py
5 http_error_auth_reqed(self, auth_header, host, req, headers)
kind=method class=AbstractDigestAuthHandler objtype=function line:1104 at …\lib\urllib\request.py
6 reset_retry_count(self)
kind=method class=AbstractDigestAuthHandler objtype=function line:1101 at …\lib\urllib\request.py
7 retry_http_digest_auth(self, req, auth)
kind=method class=AbstractDigestAuthHandler objtype=function line:1124 at …\lib\urllib\request.py
82 urllib.request.HTTPDigestAuthHandler
HTTPDigestAuthHandler, urllib.request.HTTPDigestAuthHandler, module=urllib.request, line:1227 at urllib\request.py
由RFC 2069文摘认证定义的认证协议改进了基本认证,因为它不以明文传输密码。
data
1 auth_header=Authorization kind:data type:str class:<class ‘urllib.request.HTTPDigestAuthHandler’>
2 handler_order=490 kind:data type:int class:<class ‘urllib.request.HTTPDigestAuthHandler’>
method
3 http_error_401(self, req, fp, code, msg, headers)
kind=method class=HTTPDigestAuthHandler objtype=function line:1237 at …\lib\urllib\request.py
83 urllib.request.ProxyDigestAuthHandler
ProxyDigestAuthHandler, urllib.request.ProxyDigestAuthHandler, module=urllib.request, line:1245 at urllib\request.py
data
1 auth_header=Proxy-Authorization kind:data type:str class:<class ‘urllib.request.ProxyDigestAuthHandler’>
2 handler_order=490 kind:data type:int class:<class ‘urllib.request.ProxyDigestAuthHandler’>
method
3 http_error_407(self, req, fp, code, msg, headers)
kind=method class=ProxyDigestAuthHandler objtype=function line:1250 at …\lib\urllib\request.py
84 urllib.request.AbstractHTTPHandler
AbstractHTTPHandler, urllib.request.AbstractHTTPHandler, module=urllib.request, line:1257 at urllib\request.py
method
1 do_open(self, http_class, req, **http_conn_args)
kind=method class=AbstractHTTPHandler objtype=function line:1308 at …\lib\urllib\request.py
使用http类返回请求的HTTPResponse对象。http_class 必须从 http.client 实现 HTTPConnection API。
2 do_request_(self, request)
kind=method class=AbstractHTTPHandler objtype=function line:1270 at …\lib\urllib\request.py
3 set_http_debuglevel(self, level)
kind=method class=AbstractHTTPHandler objtype=function line:1262 at …\lib\urllib\request.py
85 urllib.request.HTTPHandler
HTTPHandler, urllib.request.HTTPHandler, module=urllib.request, line:1375 at urllib\request.py
method
1 http_open(self, req)
kind=method class=HTTPHandler objtype=function line:1377 at …\lib\urllib\request.py
2 http_request(self, request)
kind=method class=HTTPHandler objtype=function line:1406 at …\lib\urllib\request.py
86 urllib.request.HTTPSHandler
HTTPSHandler, urllib.request.HTTPSHandler, module=urllib.request, line:-1 at urllib\request.py
method
1 https_open()
kind=method class=HTTPSHandler objtype=function
2 https_request()
kind=method class=HTTPSHandler objtype=function
87 urllib.request.HTTPCookieProcessor
HTTPCookieProcessor, urllib.request.HTTPCookieProcessor, module=urllib.request, line:1399 at urllib\request.py
method
1 http_request(self, request)
kind=method class=HTTPCookieProcessor objtype=function line:1406 at …\lib\urllib\request.py
2 http_response(self, request, response)
kind=method class=HTTPCookieProcessor objtype=function line:1410 at …\lib\urllib\request.py
3 https_request()
kind=method class=HTTPCookieProcessor objtype=function
4 https_response()
kind=method class=HTTPCookieProcessor objtype=function
88 urllib.request.UnknownHandler
UnknownHandler, urllib.request.UnknownHandler, module=urllib.request, line:1417 at urllib\request.py
method
1 unknown_open(self, req)
kind=method class=UnknownHandler objtype=function line:1418 at …\lib\urllib\request.py
89 urllib.request.FileHandler
FileHandler, urllib.request.FileHandler, module=urllib.request, line:1475 at urllib\request.py
data
1 names=None kind:data type:NoneType class:<class ‘urllib.request.FileHandler’>
method
2 file_open(self, req)
kind=method class=FileHandler objtype=function line:1477 at …\lib\urllib\request.py
3 get_names(self)
kind=method class=FileHandler objtype=function line:1488 at …\lib\urllib\request.py
4 open_local_file(self, req)
kind=method class=FileHandler objtype=function line:1499 at …\lib\urllib\request.py
90 urllib.request.FTPHandler
FTPHandler, urllib.request.FTPHandler, module=urllib.request, line:1532 at urllib\request.py
method
1 connect_ftp(self, user, passwd, host, port, dirs, timeout)
kind=method class=FTPHandler objtype=function line:1586 at …\lib\urllib\request.py
2 ftp_open(self, req)
kind=method class=FTPHandler objtype=function line:1533 at …\lib\urllib\request.py
91 urllib.request.CacheFTPHandler
CacheFTPHandler, urllib.request.CacheFTPHandler, module=urllib.request, line:1590 at urllib\request.py
method
1 check_cache(self)
kind=method class=CacheFTPHandler objtype=function line:1617 at …\lib\urllib\request.py
2 clear_cache(self)
kind=method class=CacheFTPHandler objtype=function line:1637 at …\lib\urllib\request.py
3 connect_ftp(self, user, passwd, host, port, dirs, timeout)
kind=method class=CacheFTPHandler objtype=function line:1606 at …\lib\urllib\request.py
4 setMaxConns(self, m)
kind=method class=CacheFTPHandler objtype=function line:1603 at …\lib\urllib\request.py
5 setTimeout(self, t)
kind=method class=CacheFTPHandler objtype=function line:1600 at …\lib\urllib\request.py
92 urllib.request.DataHandler
DataHandler, urllib.request.DataHandler, module=urllib.request, line:1643 at urllib\request.py
method
1 data_open(self, req)
kind=method class=DataHandler objtype=function line:1644 at …\lib\urllib\request.py
93 urllib.request.URLopener
URLopener, urllib.request.URLopener, module=urllib.request, line:1696 at urllib\request.py
类打开url。
这是一个类,而不仅仅是一个子例程,因为我们可能需要一组以上特定于协议的全局选项。
注意——这是一个基类,用于那些不希望自动处理错误类型302(重新定位)和401(需要授权)的人。
data
1 version=Python-urllib/3.7 kind:data type:str class:<class ‘urllib.request.URLopener’>
method
2 addheader(self, *args)
kind=method class=URLopener objtype=function line:1755 at …\lib\urllib\request.py
添加一个只供HTTP接口使用的报头,例如 u.addheader('Accept', 'sound/basic')
3 cleanup(self)
kind=method class=URLopener objtype=function line:1741 at …\lib\urllib\request.py
4 close(self)
kind=method class=URLopener objtype=function line:1738 at …\lib\urllib\request.py
5 http_error(self, url, fp, errcode, errmsg, headers, data=None)
kind=method class=URLopener objtype=function line:1969 at …\lib\urllib\request.py
处理http错误。派生类可以覆盖这个,或者提供名为http_error_DDD的特定处理程序,其中DDD是3位错误代码。
6 http_error_default(self, url, fp, errcode, errmsg, headers)
kind=method class=URLopener objtype=function line:1985 at …\lib\urllib\request.py
默认错误处理程序:关闭连接并引发OSError。
7 open(self, fullurl, data=None)
kind=method class=URLopener objtype=function line:1761 at …\lib\urllib\request.py
使用URLopener().open(file)而不是open(file, 'r')。
8 open_data(self, url, data=None)
kind=method class=URLopener objtype=function line:2099 at …\lib\urllib\request.py
使用“data”URL。
9 open_file(self, url)
kind=method class=URLopener objtype=function line:2000 at …\lib\urllib\request.py
使用本地文件或FTP取决于URL的形式。
10 open_ftp(self, url)
kind=method class=URLopener objtype=function line:2041 at …\lib\urllib\request.py
使用FTP协议。
11 open_http(self, url, data=None)
kind=method class=URLopener objtype=function line:1965 at …\lib\urllib\request.py
使用HTTP协议。
12 open_https(self, url, data=None)
kind=method class=URLopener objtype=function line:1996 at …\lib\urllib\request.py
使用HTTPS协议。
13 open_local_file(self, url)
kind=method class=URLopener objtype=function line:2009 at …\lib\urllib\request.py
使用本地文件。
14 open_unknown(self, fullurl, data=None)
kind=method class=URLopener objtype=function line:1797 at …\lib\urllib\request.py
可覆盖的接口,以打开未知的URL类型。
15 open_unknown_proxy(self, proxy, fullurl, data=None)
kind=method class=URLopener objtype=function line:1802 at …\lib\urllib\request.py
可覆盖的接口,以打开未知的URL类型。
16 retrieve(self, url, filename=None, reporthook=None, data=None)
kind=method class=URLopener objtype=function line:1808 at …\lib\urllib\request.py
检索(url)返回本地对象(filename, headers)或远程对象(tempfilename, headers)。
94 urllib.request.FancyURLopener
FancyURLopener, urllib.request.FancyURLopener, module=urllib.request, line:2141 at urllib\request.py
派生类,带有我们可以处理的错误的处理程序(也许)。
method
1 get_user_passwd(self, host, realm, clear_cache=0)
kind=method class=FancyURLopener objtype=function line:2329 at …\lib\urllib\request.py
2 http_error_301(self, url, fp, errcode, errmsg, headers, data=None)
kind=method class=FancyURLopener objtype=function line:2200 at …\lib\urllib\request.py
错误301 -也被重新定位(永久)。
3 http_error_302(self, url, fp, errcode, errmsg, headers, data=None)
kind=method class=FancyURLopener objtype=function line:2154 at …\lib\urllib\request.py
错误302 -重新定位(临时)。
4 http_error_303(self, url, fp, errcode, errmsg, headers, data=None)
kind=method class=FancyURLopener objtype=function line:2204 at …\lib\urllib\request.py
错误303 -同样重新定位(本质上与302相同)。
5 http_error_307(self, url, fp, errcode, errmsg, headers, data=None)
kind=method class=FancyURLopener objtype=function line:2208 at …\lib\urllib\request.py
错误307 -重新定位,但将POST转换为错误。
6 http_error_401(self, url, fp, errcode, errmsg, headers, data=None,
kind=method class=FancyURLopener objtype=function line:2215 at …\lib\urllib\request.py
错误401 -需要验证。本功能只支持基本认证。
7 http_error_407(self, url, fp, errcode, errmsg, headers, data=None,
kind=method class=FancyURLopener objtype=function line:2240 at …\lib\urllib\request.py
错误407 -需要代理身份验证。本功能只支持基本认证。
8 http_error_default(self, url, fp, errcode, errmsg, headers)
kind=method class=FancyURLopener objtype=function line:2150 at …\lib\urllib\request.py
默认错误处理-不引发异常。
9 prompt_user_passwd(self, host, realm)
kind=method class=FancyURLopener objtype=function line:2340 at …\lib\urllib\request.py
在GUI环境中重写这个!
10 redirect_internal(self, url, fp, errcode, errmsg, headers, data)
kind=method class=FancyURLopener objtype=function line:2172 at …\lib\urllib\request.py
11 retry_http_basic_auth(self, url, realm, data=None)
kind=method class=FancyURLopener objtype=function line:2301 at …\lib\urllib\request.py
12 retry_https_basic_auth(self, url, realm, data=None)
kind=method class=FancyURLopener objtype=function line:2315 at …\lib\urllib\request.py
13 retry_proxy_http_basic_auth(self, url, realm, data=None)
kind=method class=FancyURLopener objtype=function line:2265 at …\lib\urllib\request.py
14 retry_proxy_https_basic_auth(self, url, realm, data=None)
kind=method class=FancyURLopener objtype=function line:2283 at …\lib\urllib\request.py
95 urllib.request.ftpwrapper
ftpwrapper, urllib.request.ftpwrapper, module=urllib.request, line:2394 at urllib\request.py
open_ftp()用于缓存打开的 FTP 连接的类。
method
1 close(self)
kind=method class=ftpwrapper objtype=function line:2470 at …\lib\urllib\request.py
2 endtransfer(self)
kind=method class=ftpwrapper objtype=function line:2467 at …\lib\urllib\request.py
3 file_close(self)
kind=method class=ftpwrapper objtype=function line:2475 at …\lib\urllib\request.py
4 init(self)
kind=method class=ftpwrapper objtype=function line:2413 at …\lib\urllib\request.py
5 real_close(self)
kind=method class=ftpwrapper objtype=function line:2481 at …\lib\urllib\request.py
6 retrfile(self, file, type)
kind=method class=ftpwrapper objtype=function line:2422 at …\lib\urllib\request.py
内嵌函数或方法
96 _randombytes
私有或局部
97 _have_ssl True
98 _opener
99 _url_tempfiles []
100 _cut_port_re re.compile(‘:\d+$’, re.ASCII)
101 _parse_proxy <function _parse_proxy at 0x0000000003710B88>
102 _randombytes
103 _safe_gethostbyname <function _safe_gethostbyname at 0x000000000371B948>
104 _localhost
105 _thishost
106 _ftperrors
107 _noheaders
108 _proxy_bypass_macosx_sysconf <function _proxy_bypass_macosx_sysconf at 0x0000000003722DC8>
剩余
109 loader <_frozen_importlib_external.SourceFileLoader object at 0x00000000036ADE48>
110 spec ModuleSpec(name=‘urllib.request’, loader=<_frozen_importlib_external.SourceFileLoader object at 0x00000000036ADE48>, origin=‘…\lib\urllib\request.py’)
111 _opener
112 _cut_port_re re.compile(‘:\d+$’, re.ASCII)
113 _localhost
114 _thishost
115 _ftperrors
116 _noheaders
【types】
types, fullname=types, file=types.py
定义不能作为内置程序直接访问的内置类型的名称。
统计
序号 | 类别 | 数量 |
---|---|---|
4 | str | 5 |
6 | list | 1 |
8 | dict | 1 |
10 | class | 22 |
11 | function | 5 |
13 | residual | 2 |
14 | system | 9 |
15 | private | 2 |
16 | all | 36 |
常量
函数
1 new_class(name, bases=(), kwds=None, exec_body=None)
new_class(name, bases=(), kwds=None, exec_body=None), module=types, line:62 at types.py
使用适当的元类动态创建类对象。
2 resolve_bases(bases)
resolve_bases(bases), module=types, line:72 at types.py
根据PEP 560的指定动态解析MRO条目。
3 prepare_class(name, bases=(), kwds=None)
prepare_class(name, bases=(), kwds=None), module=types, line:93 at types.py
调用适当元类的__prepare__方法。
以三元组形式返回(metaclass, namespace, kwds)
*metaclass* 是适当的元类
*namespace* 是准备好的类命名空间
*kwds* 是传入kwds参数的更新副本,其中删除了任何'元类'条目。如果没有传入kwds参数,这将是一个空字典。
4 _calculate_meta(meta, bases)
_calculate_meta(meta, bases), module=types, line:125 at types.py
计算派生最多的元类。
5 coroutine(func)
coroutine(func), module=types, line:237 at types.py
将常规生成器函数转换为协程。
类
6 function
function, function, module=builtins, line:0 at
6、7 function
function, function, module=builtins, line:0 at
8 code
code, code, module=builtins, line:0 at
9 mappingproxy
mappingproxy, mappingproxy, module=builtins, line:0 at
10 types.SimpleNamespace
SimpleNamespace, types.SimpleNamespace, module=types, line:-1 at types.py
一个简单的基于属性的名称空间。
SimpleNamespace (* * kwargs)
11 generator
generator, generator, module=builtins, line:0 at
12 coroutine
coroutine, coroutine, module=builtins, line:0 at
13 async_generator
async_generator, async_generator, module=builtins, line:0 at
14 method
method, method, module=builtins, line:0 at
15 builtin_function_or_method
builtin_function_or_method, builtin_function_or_method, module=builtins, line:0 at
17 wrapper_descriptor
wrapper_descriptor, wrapper_descriptor, module=builtins, line:0 at
18 method-wrapper
method-wrapper, method-wrapper, module=builtins, line:0 at
19 method_descriptor
method_descriptor, method_descriptor, module=builtins, line:0 at
20 classmethod_descriptor
classmethod_descriptor, classmethod_descriptor, module=builtins, line:0 at
21 module
module, module, module=builtins, line:0 at
22 traceback
traceback, traceback, module=builtins, line:0 at
23 frame
frame, frame, module=builtins, line:0 at
24 getset_descriptor
getset_descriptor, getset_descriptor, module=builtins, line:0 at
25 member_descriptor
member_descriptor, member_descriptor, module=builtins, line:0 at
26 types.DynamicClassAttribute
DynamicClassAttribute, types.DynamicClassAttribute, module=types, line:142 at types.py
将类的属性访问路由到__getattr__。
这是一个描述符,用于定义通过实例访问和通过类访问时行为不同的属性。
实例访问仍然正常,但是通过类访问属性将被路由到类的getattr方法;
这是通过引发AttributeError来完成的。
这允许在实例上激活属性,并在类上具有相同名称的虚拟属性(示例参见Enum)。
method
1 deleter(self, fdel)
kind=method class=DynamicClassAttribute objtype=function line:194 at …\lib\types.py
2 getter(self, fget)
kind=method class=DynamicClassAttribute objtype=function line:183 at …\lib\types.py
3 setter(self, fset)
kind=method class=DynamicClassAttribute objtype=function line:189 at …\lib\types.py
27 types._GeneratorWrapper
_GeneratorWrapper, types._GeneratorWrapper, module=types, line:200 at types.py
property
1 cr_await=<property object at 0x00000000021FCEF8> kind:property type:property class:<class ‘types._GeneratorWrapper’>
2 cr_code=<property object at 0x00000000021FCE08> kind:property type:property class:<class ‘types._GeneratorWrapper’>
3 cr_frame=<property object at 0x00000000021FCE58> kind:property type:property class:<class ‘types._GeneratorWrapper’>
4 cr_running=<property object at 0x00000000021FCEA8> kind:property type:property class:<class ‘types._GeneratorWrapper’>
5 gi_code=<property object at 0x00000000021FCE08> kind:property type:property class:<class ‘types._GeneratorWrapper’>
6 gi_frame=<property object at 0x00000000021FCE58> kind:property type:property class:<class ‘types._GeneratorWrapper’>
7 gi_running=<property object at 0x00000000021FCEA8> kind:property type:property class:<class ‘types._GeneratorWrapper’>
8 gi_yieldfrom=<property object at 0x00000000021FCEF8> kind:property type:property class:<class ‘types._GeneratorWrapper’>
method
9 close(self)
kind=method class=_GeneratorWrapper objtype=function line:211 at …\lib\types.py
10 send(self, val)
kind=method class=_GeneratorWrapper objtype=function line:207 at …\lib\types.py
11 throw(self, tp, *rest)
kind=method class=_GeneratorWrapper objtype=function line:209 at …\lib\types.py
私有或局部
28 _calculate_meta <function _calculate_meta at 0x00000000021FF438>
29 _GeneratorWrapper <class ‘types._GeneratorWrapper’>
【pyexcel.plugins.parsers】
parsers, fullname=pyexcel.plugins.parsers, file=pyexcel\plugins\parsers_init_.py
pyexcel.plugins.parsers
内置解析器列表
统计
序号 | 类别 | 数量 |
---|---|---|
4 | str | 7 |
6 | list | 1 |
8 | dict | 1 |
10 | class | 1 |
13 | residual | 3 |
14 | system | 9 |
16 | all | 13 |
常量
str
1 DB_SQL sql
2 DB_DJANGO django
类
3 pyexcel.plugins.PyexcelPluginChain
PyexcelPluginChain, pyexcel.plugins.PyexcelPluginChain, module=pyexcel.plugins, line:134 at site-packages\pyexcel\plugins_init_.py
它被pyexcel插件使用
method
1 add_a_output_source(self, relative_plugin_class_path=None, **keywords)
kind=method class=PyexcelPluginChain objtype=function line:163 at …\lib\site-packages\pyexcel\plugins_init_.py
追加文件输出源
2 add_a_parser(self, relative_plugin_class_path=None, file_types=None)
kind=method class=PyexcelPluginChain objtype=function line:176 at …\lib\site-packages\pyexcel\plugins_init_.py
附加一个excel文件阅读器
3 add_a_renderer(
kind=method class=PyexcelPluginChain objtype=function line:189 at …\lib\site-packages\pyexcel\plugins_init_.py
附加一个excel文件写入器
4 add_a_source(self, relative_plugin_class_path=None, **keywords)
kind=method class=PyexcelPluginChain objtype=function line:137 at …\lib\site-packages\pyexcel\plugins_init_.py
为签名函数添加一个数据源插件
5 add_an_input_source(self, relative_plugin_class_path=None, **keywords)
kind=method class=PyexcelPluginChain objtype=function line:150 at …\lib\site-packages\pyexcel\plugins_init_.py
追加文件输入源
剩余
4 loader <_frozen_importlib_external.SourceFileLoader object at 0x0000000003AA2448>
5 spec ModuleSpec(name=‘pyexcel.plugins.parsers’, loader=<_frozen_importlib_external.SourceFileLoader object at 0x0000000003AA2448>, origin=‘…\lib\site-packages\pyexcel\plugins\parsers\init.py’, submodule_search_locations=[‘…\lib\site-packages\pyexcel\plugins\parsers’])
6 READERS <pyexcel_io.plugins.AllReaders object at 0x0000000003A7BD88>
【pyexcel.plugins.renderers】
renderers, fullname=pyexcel.plugins.renderers, file=pyexcel\plugins\renderers_init_.py
pyexcel.plugins.renderers
内置渲染器列表
统计
序号 | 类别 | 数量 |
---|---|---|
4 | str | 7 |
6 | list | 1 |
8 | dict | 1 |
10 | class | 1 |
13 | residual | 3 |
14 | system | 9 |
16 | all | 13 |
常量
str
1 DB_SQL sql
2 DB_DJANGO django
类
3 pyexcel.plugins.PyexcelPluginChain
PyexcelPluginChain, pyexcel.plugins.PyexcelPluginChain, module=pyexcel.plugins, line:134 at site-packages\pyexcel\plugins_init_.py
剩余
3 loader <_frozen_importlib_external.SourceFileLoader object at 0x0000000003AA7548>
4 spec ModuleSpec(name=‘pyexcel.plugins.renderers’, loader=<_frozen_importlib_external.SourceFileLoader object at 0x0000000003AA7548>, origin=‘…\lib\site-packages\pyexcel\plugins\renderers\init.py’, submodule_search_locations=[‘…\lib\site-packages\pyexcel\plugins\renderers’])
5 WRITERS <pyexcel_io.plugins.AllWriters object at 0x0000000003A7BDC8>
【pyexcel.plugins.sources】
sources, fullname=pyexcel.plugins.sources, file=pyexcel\plugins\sources_init_.py
pyexcel.plugins.sources
内置源代码列表
统计
序号 | 类别 | 数量 |
---|---|---|
4 | str | 5 |
6 | list | 1 |
8 | dict | 1 |
10 | class | 1 |
13 | residual | 4 |
14 | system | 9 |
16 | all | 12 |
常量
类
1 pyexcel.plugins.PyexcelPluginChain
PyexcelPluginChain, pyexcel.plugins.PyexcelPluginChain, module=pyexcel.plugins, line:134 at site-packages\pyexcel\plugins_init_.py
剩余
1 loader <_frozen_importlib_external.SourceFileLoader object at 0x0000000003AAA1C8>
2 spec ModuleSpec(name=‘pyexcel.plugins.sources’, loader=<_frozen_importlib_external.SourceFileLoader object at 0x0000000003AAA1C8>, origin=‘…\lib\site-packages\pyexcel\plugins\sources\init.py’, submodule_search_locations=[‘…\lib\site-packages\pyexcel\plugins\sources’])
3 PARSER <pyexcel.internal.plugins.IOPluginManager object at 0x0000000003A5D4C8>
4 RENDERER <pyexcel.internal.plugins.IOPluginManager object at 0x0000000003A56588>
【pyexcel.docstrings.keywords】
keywords, fullname=pyexcel.docstrings.keywords, file=pyexcel\docstrings\keywords.py
pyexcel.docstrings.keywords
签名函数中关键字的可重构文档字符串
统计
序号 | 类别 | 数量 |
---|---|---|
4 | str | 22 |
8 | dict | 1 |
13 | residual | 2 |
14 | system | 8 |
16 | all | 25 |
常量
str
1 CSV_PARAMS
> 参见:** csv文件格式相关参数 **
> 【pyexcel.docstrings.keywords】/常量/str/1 CSV_PARAMS
参见:** csv文件格式相关参数 **
【pyexcel.docstrings.keywords】/常量/str/1 CSV_PARAMS
2 XLRD_PARAMS
** xls文件格式相关参数 :**
请注意以下参数适用于pyexcel-xls。更多细节可以在:func: ' xlrd.open_workbook '中找到
logfile: 将消息和诊断信息写入其中的打开文件。
verbosity: 增加写入日志文件的跟踪材料的容量。
use_mmap: 是否使用mmap模块是启发式决定的。使用这个参数来覆盖结果。
当前启发式:如果存在mmap,则使用它。
encoding_override: 用于克服旧版本文件中缺失或错误的代码页信息。
formatting_info: 默认为False,这样可以节省内存。
当为True时,格式化信息将从电子表格文件中读取。这将提供所有单元格,包括空单元格和空白单元格。每个单元格都有格式化信息。
ragged_rows: 默认值为False意味着所有行都用空单元格填充,以便所有行都具有与ncols中相同的大小。
True表示行末尾没有空单元格。如果行大小相差很大,这可以节省大量内存。另请参阅row_len()方法。
参见:** xls文件格式相关参数 😗*
【pyexcel.docstrings.keywords】/常量/str/2 XLRD_PARAMS
3 OPTIONAL_BOOK_PARAMS
sheets:
表单:
要读取的混合表名称和表单索引的列表。
这样做是为了保持 Pandas 的紧致性。
使用此参数,可以读取多个工作表,并且可以控制读取感兴趣的工作表,而不是所有可用的工作表。
参见:sheets:表单
【pyexcel.docstrings.keywords】/常量/str/3 OPTIONAL_BOOK_PARAMS
4 OPTIONAL_PARAMS
auto_detect_float : 默认为True
auto_detect_int : 默认为True
auto_detect_datetime : 默认为True
ignore_infinity : 默认为True
library : 选择一个特定的pyexcel-io插件进行读取
source_library : 选择一个特定的数据源插件进行读取
parser_library : 选择一个pyexcel解析器插件进行阅读
skip_hidden_sheets: 默认为True。请切换它以读取隐藏的表
参见:OPTIONAL_PARAMS
【pyexcel.docstrings.keywords】/常量/str/4 OPTIONAL_PARAMS
5 FILE_PARAMS
file_name : 具有支持的文件扩展名的文件
file_content : 文件内容
file_stream : 文件流
file_type : *file_content*或*file_stream*中的文件类型
参见:FILE_PARAMS
【pyexcel.docstrings.keywords】/常量/str/5 FILE_PARAMS
6 SKIPPING_FUNC_PROTOCOL
协议是:
返回 pyexcel_io.constants.SKIP_DATA,如果跳过数据,
返回 pyexcel_io.constants.TAKE_DATA,如果读取数据,
返回 pyexcel_io.constants.STOP_ITERATION,如果退出读取数据。
参见:SKIPPING_FUNC_PROTOCOL
【pyexcel.docstrings.keywords】/常量/str/6 SKIPPING_FUNC_PROTOCOL
7 PAGINATION_PARAMS
start_row : int
默认值为0。它允许您在开始时跳过行。
row_limit: int
默认为-1,表示直到整个表的末尾。它允许你要跳过尾行。
start_column : int
默认值为0。它允许你跳过左边的列。
column_limit: int
默认为-1,表示直到列的末尾。它允许你可以跳过后面的列。
skip_row_func:
它允许您编写自己的跳行函数。
+ SKIPPING_FUNC_PROTOCOL
skip_column_func:
它允许您编写自己的跳列函数。
+ SKIPPING_FUNC_PROTOCOL
skip_empty_rows: bool
默认为False。如果其余空行无用,则将其切换为True,但它确实会影响行数。
row_renderer:
您可以选择在读取数据时编写自定义行呈现器。
参见:PAGINATION_PARAMS
【pyexcel.docstrings.keywords】/常量/str/7 PAGINATION_PARAMS
8 SOURCE_PARAMS
+ FILE_PARAMS
session : 数据库会话
table : 数据库表
model: django模型
adict: 一维数组的字典
url: excel文件的下载HTTP url
with_keys: 加载前一个字典的键,默认为True
records : 具有相同键的字典列表
array : 一个二维数组,一个列表的列表
sheet_name: 表的名字。如果没有指定sheet_name,则加载索引0处的默认表
+ PAGINATION_PARAMS
+ OPTIONAL_PARAMS
+ CSV_PARAMS
+ XLRD_PARAMS
参见:SOURCE_PARAMS
【pyexcel.docstrings.keywords】/常量/str/8 SOURCE_PARAMS
9 SOURCE_PARAMS_TABLE
数据源参数表。并非所有参数都需要。见下表:
========================== =========================================
源 参数
========================== =========================================
loading from file file_name, sheet_name, keywords
loading from string file_content, file_type, sheet_name, keywords
loading from stream file_stream, file_type, sheet_name, keywords
loading from sql session, table
loading from sql in django model
loading from query sets any query sets(sqlalchemy or django)
loading from dictionary adict, with_keys
loading from records records
loading from array array
loading from an url url
========================== =========================================
参见:SOURCE_PARAMS_TABLE
【pyexcel.docstrings.keywords】/常量/str/9 SOURCE_PARAMS_TABLE
10 DEST_FILE_PARAMS
dest_file_name: 另一个文件名。
dest_file_type: 如果您想保存到内存,这是必需的。
参见:DEST_FILE_PARAMS
【pyexcel.docstrings.keywords】/常量/str/10 DEST_FILE_PARAMS
11 DEST_PARAMS
+ DEST_FILE_PARAMS
dest_session: 目标数据库会话
dest_table: 目标表
dest_model: 目标django模型
dest_mapdict: 映射字典。参见::meth:`pyexcel.Sheet.save_to_memory`
dest_initializer: 表或模型的自定义初始化函数
dest_mapdict: 指定标头
dest_batch_size: 对象创建批处理大小。它是Django特有的
dest_library: 选择一个特定的pyexcel-io插件进行编写
dest_source_library: 选择一个特定的数据源插件进行写入
dest_renderer_library: 选择一个pyexcel解析器插件进行编写
参见:DEST_PARAMS
【pyexcel.docstrings.keywords】/常量/str/11 DEST_PARAMS
12 DEST_PARAMS_TABLE
================= =============================================
保存到源 参数
================= =============================================
file dest_file_name, dest_sheet_name,dest_force_file_type
带前缀 'dest' 的关键字
memory dest_file_type, dest_content,
dest_sheet_name, 带前缀 'dest' 的关键字
sql dest_session, dest_table,
dest_initializer, dest_mapdict
django model dest_model, dest_initializer,
dest_mapdict, dest_batch_size
================= =============================================
参见:DEST_PARAMS_TABLE
【pyexcel.docstrings.keywords】/常量/str/12 DEST_PARAMS_TABLE
13 DEST_BOOK_PARAMS
+ DEST_FILE_PARAMS
dest_session: 目标数据库会话
dest_tables: 目标目标表的列表
dest_models: django的目标模型列表
dest_mapdicts: 映射字典的列表
dest_initializers: 表初始化函数
dest_mapdicts: 指定一个模型或表字段。可选
dest_batch_size: 批量创建大小。可选
参见:DEST_BOOK_PARAMS
【pyexcel.docstrings.keywords】/常量/str/13 DEST_BOOK_PARAMS
14 SOURCE_BOOK_PARAMS
+ FILE_PARAMS
session : 数据库会话
tables : 一个数据库表的列表
models : django模型列表
bookdict : 二维数组的字典
url : excel文件的下载HTTP url
+ OPTIONAL_BOOK_PARAMS
+ OPTIONAL_PARAMS
+ CSV_PARAMS
参见:SOURCE_BOOK_PARAMS
【pyexcel.docstrings.keywords】/常量/str/14 SOURCE_BOOK_PARAMS
15 SOURCE_BOOK_PARAMS_TABLE
以下是参数表:
========================== ===============================
源 参数
========================== ===============================
loading from file file_name, keywords
loading from string file_content, file_type, keywords
loading from stream file_stream, file_type, keywords
loading from sql session, tables
loading from django models models
loading from dictionary bookdict
loading from an url url
========================== ===============================
其中字典应该有文本作为键,二维数组作为值。
参见:SOURCE_BOOK_PARAMS_TABLE
【pyexcel.docstrings.keywords】/常量/str/15 SOURCE_BOOK_PARAMS_TABLE
16 I_NOTE
对于csv, csvz文件格式,文件句柄将保持打开状态。
对于xls、ods文件格式,文件将全部读入内存,然后关闭。
对于xlsx,文件句柄在python 2.7 - 3.5中通过pyexcel-xlsx(openpyxl)保持打开状态。
换句话说,pyexcel-xls、pyexcel-ods、pyexcel-ods3不会泄露文件句柄。
参见:I_NOTE
【pyexcel.docstrings.keywords】/常量/str/16 I_NOTE
17 EXAMPLE_NOTE_PAGINATION
** 关于 start_row, start_column 的例子 **
.. 测试代码::
:hide:
>>> import sys
>>> if sys.version_info[0] < 3:
... from StringIO import StringIO
... else:
... from io import StringIO
>>> from pyexcel_io._compact import OrderedDict
让我们假设下面的文件是一个巨大的csv文件:
.. code-block:: python
>>> import datetime
>>> import pyexcel as pe
>>> data = [
... [1, 21, 31],
... [2, 22, 32],
... [3, 23, 33],
... [4, 24, 34],
... [5, 25, 35],
... [6, 26, 36]
... ]
>>> pe.save_as(array=data, dest_file_name="your_file.csv")
假设读取部分数据:
.. code-block:: python
>>> pe.get_sheet(file_name="your_file.csv", start_row=2, row_limit=3)
your_file.csv:
+---+----+----+
| 3 | 23 | 33 |
+---+----+----+
| 4 | 24 | 34 |
+---+----+----+
| 5 | 25 | 35 |
+---+----+----+
你也可以对列做同样的事情:
.. code-block:: python
>>> pe.get_sheet(file_name="your_file.csv", start_column=1, column_limit=2)
your_file.csv:
+----+----+
| 21 | 31 |
+----+----+
| 22 | 32 |
+----+----+
| 23 | 33 |
+----+----+
| 24 | 34 |
+----+----+
| 25 | 35 |
+----+----+
| 26 | 36 |
+----+----+
显然,你可以同时做这两件事:
.. code-block:: python
>>> pe.get_sheet(file_name="your_file.csv",
... start_row=2, row_limit=3,
... start_column=1, column_limit=2)
your_file.csv:
+----+----+
| 23 | 33 |
+----+----+
| 24 | 34 |
+----+----+
| 25 | 35 |
+----+----+
所有pyexcel插件都支持分页.
.. 注意::
不支持将查询集作为数据源的列分页.
*在转换大数据文件时格式化*
如果你要对一个大数据集进行代码转换,传统的格式化方法就不行,除非按需提供空闲的RAM。
不过,还是有办法的,在执行格式化时,尽量减少pyexcel的内存占用。
让我们继续前面的例子。假设我们要进行代码转换:"your_file.csv"到"your_file.xls",但每个元素都加1。
我们能做的是定义一个行渲染器函数,如下所示:
>>> def increment_by_one(row):
... for element in row:
... yield element + 1
然后使用row_renderer将它传递给save_as函数:
>>> pe.isave_as(file_name="your_file.csv",
... row_renderer=increment_by_one,
... dest_file_name="your_file.xlsx")
.. 注意::
如果数据内容来自生成器,则必须使用isave_as。
我们可以验证它是否正确:
>>> pe.get_sheet(file_name="your_file.xlsx")
your_file.csv:
+---+----+----+
| 2 | 22 | 32 |
+---+----+----+
| 3 | 23 | 33 |
+---+----+----+
| 4 | 24 | 34 |
+---+----+----+
| 5 | 25 | 35 |
+---+----+----+
| 6 | 26 | 36 |
+---+----+----+
| 7 | 27 | 37 |
+---+----+----+
.. testcode::
:hide:
>>> import os
>>> pe.free_resources()
>>> os.unlink("your_file.csv")
>>> os.unlink("your_file.xlsx")
参见:EXAMPLE_NOTE_PAGINATION
【pyexcel.docstrings.keywords】/常量/str/17 EXAMPLE_NOTE_PAGINATION
【pyexcel.docstrings.core】
core, fullname=pyexcel.docstrings.core, file=pyexcel\docstrings\core.py
【pyexcel.docstrings.meta】
meta, fullname=pyexcel.docstrings.meta, file=pyexcel\docstrings\meta.py
pyexcel.docstrings.meta
pyexcel.internal.meta 的可重构文档字符串
统计
序号 | 类别 | 数量 |
---|---|---|
4 | str | 7 |
8 | dict | 1 |
13 | residual | 2 |
14 | system | 8 |
16 | all | 10 |
常量
str
1 CSV_PARAMS
Parameters related to csv file format
for csv, `fmtparams <https://docs.python.org/release/3.1.5/
library/csv.html…
2 SAVE_AS_OPTIONS
Keywords may vary depending on your file type, because the associated
file type employs different library.
**PARAMETER…
【pyexcel.docstrings.garbagecollector】
garbagecollector, fullname=pyexcel.docstrings.garbagecollector, file=pyexcel\docstrings\garbagecollector.py
统计
序号 | 类别 | 数量 |
---|---|---|
4 | str | 6 |
8 | dict | 1 |
13 | residual | 3 |
14 | system | 8 |
16 | all | 10 |
常量
str
1 I_NOTE
for csv, csvz file formats, file handles will be left open.
for xls, ods file formats, the file is read all into memory…
2 FREE_RESOURCES
for csv, csvz file formats, file handles will be left open.
for xls, ods file formats, the file is read all into memory…
【pyexcel.internal.plugins】
plugins, fullname=pyexcel.internal.plugins, file=pyexcel\internal\plugins.py
【pyexcel.internal.common】
common, fullname=pyexcel.internal.common, file=pyexcel\internal\common.py
pyexcel.internal.common
共享对象的定义
统计
序号 | 类别 | 数量 |
---|---|---|
4 | str | 6 |
8 | dict | 1 |
10 | class | 1 |
11 | function | 2 |
13 | residual | 2 |
14 | system | 8 |
16 | all | 12 |
常量
str
1 NO_COLUMN_NAMES Only sheet with column names is accepted
函数
2 get_sheet_headers(sheet)
get_sheet_headers(sheet), module=pyexcel.internal.common, line:37 at site-packages\pyexcel\internal\common.py
3 get_book_headers_in_array(book)
get_book_headers_in_array(book), module=pyexcel.internal.common, line:49 at site-packages\pyexcel\internal\common.py
类
4 pyexcel.internal.common.SheetIterator
SheetIterator, pyexcel.internal.common.SheetIterator, module=pyexcel.internal.common, line:13 at site-packages\pyexcel\internal\common.py
表迭代器
method
1 next(self)
kind=method class=SheetIterator objtype=function line:28 at …\lib\site-packages\pyexcel\internal\common.py
下一页
【pyexcel.internal.generators】
generators, fullname=pyexcel.internal.generators, file=pyexcel\internal\generators.py
pyexcel.internal.generators
表和工作簿生成器的定义。
统计
序号 | 类别 | 数量 |
---|---|---|
4 | str | 5 |
8 | dict | 1 |
10 | class | 4 |
13 | residual | 2 |
14 | system | 8 |
16 | all | 12 |
常量
类
1 collections.OrderedDict
OrderedDict, collections.OrderedDict, module=collections, line:81 at collections_init_.py
记忆插入顺序的字典
method
1 clear(self)
kind=method class=OrderedDict objtype=method_descriptor line:160 at …\lib\collections_init_.py
od.clear() -> None。 从od中移除所有项目。
2 copy(self)
kind=method class=OrderedDict objtype=method_descriptor line:280 at …\lib\collections_init_.py
od.copy() -> od.copy的浅拷贝
3 items(self)
kind=method class=OrderedDict objtype=method_descriptor line:230 at …\lib\collections_init_.py
4 keys(self)
kind=method class=OrderedDict objtype=method_descriptor line:226 at …\lib\collections_init_.py
5 move_to_end(self, key, last=True)
kind=method class=OrderedDict objtype=method_descriptor line:190 at …\lib\collections_init_.py
将现有元素移到末尾(如果last为false则移到开头)。
如果元素不存在则引发KeyError。
6 pop(self, key, default=__marker)
kind=method class=OrderedDict objtype=method_descriptor line:242 at …\lib\collections_init_.py
od.pop(k[,d]) -> v, 删除指定键并返回相应值。
如果没有找到key,则返回d,否则引发KeyError。
7 popitem(self, last=True)
kind=method class=OrderedDict objtype=method_descriptor line:167 at …\lib\collections_init_.py
从字典中删除并返回一个(key, value)对。如果last为真,则按后进先出顺序返回,如果为假,则按先进先出顺序返回。
Pairs are returned in LIFO order if last is true or FIFO order if false.』
8 setdefault(self, key, default=None)
kind=method class=OrderedDict objtype=method_descriptor line:256 at …\lib\collections_init_.py
如果key不在字典中,则插入值为default的key。如果key在字典中,则返回key的值,否则为default。
9 update(*args, **kwds)
kind=method class=OrderedDict objtype=method_descriptor line:619 at …\lib\collections_init_.py
10 values(self)
kind=method class=OrderedDict objtype=method_descriptor line:234 at …\lib\collections_init_.py
class method
11 fromkeys(cls, iterable, value=None)
kind=class method class=OrderedDict objtype=classmethod_descriptor line:285 at …\lib\collections_init_.py
创建一个新的有序字典,键来自iterable,值设置为value。
2 pyexcel.internal.common.SheetIterator
SheetIterator, pyexcel.internal.common.SheetIterator, module=pyexcel.internal.common, line:13 at site-packages\pyexcel\internal\common.py
2 pyexcel.internal.generators.SheetStream
SheetStream, pyexcel.internal.generators.SheetStream, module=pyexcel.internal.generators, line:14 at site-packages\pyexcel\internal\generators.py
高效内存表表示法
这个类包装了从pyexcel-io读取的数据。与:class:`pyexcel.Sheet`相比,该类的实例不会将所有数据加载到内存中。
因此,它在处理大数据时表现更好。
如果你想对二维数据的每一行进行自定义渲染,你需要将一行格式化/渲染函数传递给pyexcel签名函数的参数“renderer”。
property
1 array=<property object at 0x0000000003A61C78> kind:property type:property class:<class ‘pyexcel.internal.generators.SheetStream’>
method
2 get_internal_array(self)
kind=method class=SheetStream objtype=function line:46 at …\lib\site-packages\pyexcel\internal\generators.py
3 to_array(self)
kind=method class=SheetStream objtype=function line:35 at …\lib\site-packages\pyexcel\internal\generators.py
简单地返回生成器
2 pyexcel.internal.generators.BookStream
BookStream, pyexcel.internal.generators.BookStream, module=pyexcel.internal.generators, line:50 at site-packages\pyexcel\internal\generators.py
内存高效的工作簿表示。
与:class:`pyexcel.Book`相比,这个类的实例使用:class:`pyexcel.generators.SheetStream`作为表对象的内部表示。
因为`SheetStream` 不将数据读入内存,所以它是内存高效的。
method
1 load_from_sheets(self, sheets)
kind=method class=BookStream objtype=function line:77 at …\lib\site-packages\pyexcel\internal\generators.py
从现有的工作表中加载内容。
:param dict sheets: 工作表字典。每张表都是列表的列表
2 number_of_sheets(self)
kind=method class=BookStream objtype=function line:114 at …\lib\site-packages\pyexcel\internal\generators.py
返回表的数量
3 sheet_names(self)
kind=method class=BookStream objtype=function line:99 at …\lib\site-packages\pyexcel\internal\generators.py
4 to_dict(self)
kind=method class=BookStream objtype=function line:102 at …\lib\site-packages\pyexcel\internal\generators.py
获取工作簿数据结构作为字典
【pyexcel.internal.attributes】
attributes, fullname=pyexcel.internal.attributes, file=pyexcel\internal\attributes.py
pyexcel.internal.attributes
工作簿和表格属性
统计
序号 | 类别 | 数量 |
---|---|---|
4 | str | 5 |
8 | dict | 2 |
9 | module | 1 |
11 | function | 3 |
13 | residual | 2 |
14 | system | 8 |
16 | all | 13 |
常量
dict
1 ATTRIBUTE_REGISTRY {‘sheet’: {‘read’: {‘queryset’, ‘url’, ‘pdf’, ‘html’, ‘xlsb’}, ‘write’: {‘texttable’}, ‘read-write’: {‘dict’, ‘records’,…
模块
2 pyexcel.constants
constants, fullname=pyexcel.constants, file=pyexcel\constants.py
函数
3 register_book_attribute(target, action, attr)
register_book_attribute(target, action, attr), module=pyexcel.internal.attributes, line:26 at site-packages\pyexcel\internal\attributes.py
4 register_sheet_attribute(target, action, attr)
register_sheet_attribute(target, action, attr), module=pyexcel.internal.attributes, line:32 at site-packages\pyexcel\internal\attributes.py
5 register_an_attribute(meta_cls, target, action, attr)
register_an_attribute(meta_cls, target, action, attr), module=pyexcel.internal.attributes, line:38 at site-packages\pyexcel\internal\attributes.py
将文件类型注册为属性
【pyexcel.internal.source_plugin】
source_plugin, fullname=pyexcel.internal.source_plugin, file=pyexcel\internal\source_plugin.py
pyexcel.internal.source_plugin
第二级抽象
统计
序号 | 类别 | 数量 |
---|---|---|
4 | str | 6 |
5 | tuple | 1 |
8 | dict | 1 |
9 | module | 3 |
10 | class | 2 |
11 | function | 4 |
13 | residual | 3 |
14 | system | 8 |
15 | private | 2 |
16 | all | 20 |
常量
str
1 REGISTRY_KEY_FORMAT %s-%s
tuple
2 NO_DOT_NOTATION (‘django’, ‘sql’)
模块
3 pyexcel.constants
constants, fullname=pyexcel.constants, file=pyexcel\constants.py
4 pyexcel.exceptions
exceptions, fullname=pyexcel.exceptions, file=pyexcel\exceptions.py
5 pyexcel_io.constants
constants, fullname=pyexcel_io.constants, file=pyexcel_io\constants.py
函数
6 register_book_attribute(target, action, attr)
register_book_attribute(target, action, attr), module=pyexcel.internal.attributes, line:26 at site-packages\pyexcel\internal\attributes.py
7 register_sheet_attribute(target, action, attr)
register_sheet_attribute(target, action, attr), module=pyexcel.internal.attributes, line:32 at site-packages\pyexcel\internal\attributes.py
8 _error_handler(action, **keywords)
_error_handler(action, **keywords), module=pyexcel.internal.source_plugin, line:134 at site-packages\pyexcel\internal\source_plugin.py
9 _get_me_pypi_package_name(module_name)
_get_me_pypi_package_name(module_name), module=pyexcel.internal.source_plugin, line:154 at site-packages\pyexcel\internal\source_plugin.py
类
10 lml.plugin.PluginManager
PluginManager, lml.plugin.PluginManager, module=lml.plugin, line:0 at
将插件信息加载到内存字典中,以便以后导入
参数:
--------------
plugin_type:
插件类型。所有该插件类型的插件都将被注册到它。
method
1 dynamic_load_library()
kind=method class=PluginManager objtype=function
动态加载插件信息,如果没有加载
参数:
--------------
a_plugin_info: 一个插件信息的实例
2 get_a_plugin()
kind=method class=PluginManager objtype=function
获取插件。
参数:
---------------
key: 查找插件的关键字
keywords: 附加参数,用于帮助检索插件
3 get_primary_key()
kind=method class=PluginManager objtype=function
4 load_me_later()
kind=method class=PluginManager objtype=function
为以后的加载注册一个插件信息
参数:
--------------
plugin_info: 插件信息的实例
5 load_me_now()
kind=method class=PluginManager objtype=function
参数键::使用特定的插件模块
从插件注册表导入插件
参数:
-----------------
key: 查找插件库的关键字
library: 使用特定的插件模块
6 raise_exception()
kind=method class=PluginManager objtype=function
引发插件未发现异常
重写此方法以引发自定义异常
参数:
-----------------
key: 用于查找插件的键
7 register_a_plugin()
kind=method class=PluginManager objtype=function
用于在运行时动态加载插件
参数:
--------------
plugin_cls: 第二个参数所引用的实际插件类
plugin_info: plugin info的实例
11 pyexcel.internal.source_plugin.SourcePluginManager
SourcePluginManager, pyexcel.internal.source_plugin.SourcePluginManager, module=pyexcel.internal.source_plugin, line:25 at site-packages\pyexcel\internal\source_plugin.py
数据源插件加载器
method
1 get_a_plugin(
kind=method class=SourcePluginManager objtype=function line:60 at …\lib\site-packages\pyexcel\internal\source_plugin.py
获取签名函数的源插件
2 get_book_source(self, **keywords)
kind=method class=SourcePluginManager objtype=function line:83 at …\lib\site-packages\pyexcel\internal\source_plugin.py
获取一个工作簿读签名函数的源插件
3 get_keyword_for_parameter(self, key)
kind=method class=SourcePluginManager objtype=function line:101 at …\lib\site-packages\pyexcel\internal\source_plugin.py
属性的自定义关键字
4 get_source(self, **keywords)
kind=method class=SourcePluginManager objtype=function line:77 at …\lib\site-packages\pyexcel\internal\source_plugin.py
获取一个表读取源插件签名功能
5 get_writable_book_source(self, **keywords)
kind=method class=SourcePluginManager objtype=function line:95 at …\lib\site-packages\pyexcel\internal\source_plugin.py
获取一工作簿写签名函数的源插件
6 get_writable_source(self, **keywords)
kind=method class=SourcePluginManager objtype=function line:89 at …\lib\site-packages\pyexcel\internal\source_plugin.py
获取一个表写源插件签名功能
7 load_me_later(self, plugin_info)
kind=method class=SourcePluginManager objtype=function line:32 at …\lib\site-packages\pyexcel\internal\source_plugin.py
8 load_me_now(self, key, action=None, library=None, **keywords)
kind=method class=SourcePluginManager objtype=function line:36 at …\lib\site-packages\pyexcel\internal\source_plugin.py
获取源模块到内存中以供使用
9 register_a_plugin(self, plugin_cls, plugin_info)
kind=method class=SourcePluginManager objtype=function line:55 at …\lib\site-packages\pyexcel\internal\source_plugin.py
对于动态加载的插件
私有或局部
12 _error_handler <function _error_handler at 0x0000000003A5F558>
13 _get_me_pypi_package_name <function _get_me_pypi_package_name at 0x0000000003A97558>
剩余
14 loader <_frozen_importlib_external.SourceFileLoader object at 0x0000000003A65248>
15 spec ModuleSpec(name=‘pyexcel.internal.source_plugin’, loader=<_frozen_importlib_external.SourceFileLoader object at 0x0000000003A65248>, origin=‘…\lib\site-packages\pyexcel\internal\source_plugin.py’)
16 SOURCE <pyexcel.internal.source_plugin.SourcePluginManager object at 0x0000000003A65B08>
【pyexcel.internal.core】
core, fullname=pyexcel.internal.core, file=pyexcel\internal\core.py
【pyexcel.internal.utils】
utils, fullname=pyexcel.internal.utils, file=pyexcel\internal\utils.py
统计
序号 | 类别 | 数量 |
---|---|---|
4 | str | 4 |
8 | dict | 1 |
11 | function | 3 |
13 | residual | 3 |
14 | system | 8 |
16 | all | 11 |
常量
函数
1 default_getter(attribute=None)
default_getter(attribute=None), module=pyexcel.internal.utils, line:1 at site-packages\pyexcel\internal\utils.py
缺少渲染器方法的默认方法,例如,不支持写入特定文件类型的数据,但支持读取数据
2 default_setter(attribute=None)
default_setter(attribute=None), module=pyexcel.internal.utils, line:16 at site-packages\pyexcel\internal\utils.py
缺少解析器方法时的默认方法,例如,缺少读取特定文件类型中的数据的支持,但存在写入数据的支持
3 make_a_property(cls, attribute, doc_string, getter_func=<function default_getter at 0x0000000003AAEDC8>, setter_func=<function default_setter at 0x0000000003AB7CA8>)
make_a_property(cls, attribute, doc_string, getter_func=<function default_getter at 0x0000000003AAEDC8>, setter_func=<function default_setter at 0x0000000003AB7CA8>), module=pyexcel.internal.utils, line:31 at site-packages\pyexcel\internal\utils.py
为每个类创建自定义属性
【pyexcel.internal.meta】
meta, fullname=pyexcel.internal.meta, file=pyexcel\internal\meta.py
pyexcel.internal.meta
注释表和工作簿类的属性
统计
序号 | 类别 | 数量 |
---|---|---|
2 | bool | 1 |
4 | str | 5 |
8 | dict | 1 |
9 | module | 3 |
10 | class | 5 |
11 | function | 12 |
13 | residual | 9 |
14 | system | 8 |
15 | private | 1 |
16 | all | 36 |
常量
bool
1 PY2 False
模块
2 sys
sys, fullname=sys, file=
3 pyexcel.constants
constants, fullname=pyexcel.constants, file=pyexcel\constants.py
4 pyexcel.docstrings
docstrings, fullname=pyexcel.docstrings, file=pyexcel\docstrings_init_.py
函数
5 append_doc(value)
append_doc(value), module=pyexcel._compact, line:68 at site-packages\pyexcel_compact.py
6 save_book(book, **keywords)
save_book(book, **keywords), module=pyexcel.internal.core, line:50 at site-packages\pyexcel\internal\core.py
将工作簿实例保存到任何源
7 save_sheet(sheet, **keywords)
save_sheet(sheet, **keywords), module=pyexcel.internal.core, line:42 at site-packages\pyexcel\internal\core.py
将表实例保存到任何源
8 get_sheet_stream(**keywords)
get_sheet_stream(**keywords), module=pyexcel.internal.core, line:15 at site-packages\pyexcel\internal\core.py
从excel源代码中获取一个SheetStream实例
9 make_a_property(cls, attribute, doc_string, getter_func=<function default_getter at 0x0000000003AAEDC8>, setter_func=<function default_setter at 0x0000000003AB7CA8>)
make_a_property(cls, attribute, doc_string, getter_func=<function default_getter at 0x0000000003AAEDC8>, setter_func=<function default_setter at 0x0000000003AB7CA8>), module=pyexcel.internal.utils, line:31 at site-packages\pyexcel\internal\utils.py
为每个类创建自定义属性
10 make_presenter(source_getter, attribute=None)
make_presenter(source_getter, attribute=None), module=pyexcel.internal.meta, line:21 at site-packages\pyexcel\internal\meta.py
为每种文件类型创建一个自定义的表示方法
11 sheet_presenter(attribute=None)
sheet_presenter(attribute=None), module=pyexcel.internal.meta, line:43 at site-packages\pyexcel\internal\meta.py
为工作表制作一个自定义的表示方法
12 book_presenter(attribute=None)
book_presenter(attribute=None), module=pyexcel.internal.meta, line:49 at site-packages\pyexcel\internal\meta.py
为工作簿制作一个自定义的演示方法
13 importer(attribute=None)
importer(attribute=None), module=pyexcel.internal.meta, line:55 at site-packages\pyexcel\internal\meta.py
为工作表制作一个自定义输入法
14 book_importer(attribute=None)
book_importer(attribute=None), module=pyexcel.internal.meta, line:77 at site-packages\pyexcel\internal\meta.py
为工作簿制作一个自定义输入法
15 attribute(cls, file_type, instance_name=‘Sheet’, description=‘\nGet data in {0} format\n\nYou could obtain content in {0} format by dot notation::\n\n {1}.{0}\n\nif you need to pass on more parameters, you could use::\n\n {1}.get_{0}(**keywords)\n’, **keywords)
attribute(cls, file_type, instance_name=‘Sheet’, description=‘\nGet data in {0} format\n\nYou could obtain content in {0} format by dot notation::\n\n {1}.{0}\n\nif you need to pass on more parameters, you could use::\n\n {1}.get_{0}(**keywords)\n’, **keywords), module=pyexcel.internal.meta, line:95 at site-packages\pyexcel\internal\meta.py
为每个类创建自定义属性
16 _get_book(**keywords)
_get_book(**keywords), module=pyexcel.internal.meta, line:402 at site-packages\pyexcel\internal\meta.py
从excel源获取:class:`Book`的一个实例,其中字典应该有文本作为键和二维数组作为值。
类
17 functools.partial
partial, functools.partial, module=functools, line:234 at functools.py
18 pyexcel.internal.meta.StreamAttribute
StreamAttribute, pyexcel.internal.meta.StreamAttribute, module=pyexcel.internal.meta, line:146 at site-packages\pyexcel\internal\meta.py
提供 get_*_stream 方法的访问
19 pyexcel.internal.meta.PyexcelObject
PyexcelObject, pyexcel.internal.meta.PyexcelObject, module=pyexcel.internal.meta, line:157 at site-packages\pyexcel\internal\meta.py
parent class for pyexcel.Sheet and pyexcel.Book
property
1 stream=<property object at 0x0000000003ABA908> kind:property type:property class:<class ‘pyexcel.internal.meta.PyexcelObject’>
method
2 plot(self, file_type=“svg”, **keywords)
kind=method class=PyexcelObject objtype=function line:208 at …\lib\site-packages\pyexcel\internal\meta.py
数据可视化。
参数::
-----------------
file_type:string 缺省为 'svg' 。依赖于插件,'png', 'jpeg' 也有可能。
chart_type:string 缺省为 'bar' 。其他图表类型受制于插件。
3 save_to_memory(self, file_type, **keywords)
kind=method class=PyexcelObject objtype=function line:196 at …\lib\site-packages\pyexcel\internal\meta.py
保存到内存。
:param file_type: 以下任何类型: 'csv', 'tsv', 'csvz', 'tsvz', 'xls', 'xlsm', 'xlsm', 'ods'
:param stream: 要写入的内存流。注意在python3中,对于csv和tsv格式,请传递一个StringIO实例。对于xls、xlsx和ods,是BytesIO的一个实例。
20 pyexcel.internal.meta.SheetMeta
SheetMeta, pyexcel.internal.meta.SheetMeta, module=pyexcel.internal.meta, line:250 at site-packages\pyexcel\internal\meta.py
注释表属性
property
1 array=<property object at 0x0000000003AC4F98> kind:property type:property class:<class ‘pyexcel.internal.meta.SheetMeta’>
2 bookdict=<property object at 0x0000000003AC4A98> kind:property type:property class:<class ‘pyexcel.internal.meta.SheetMeta’>
3 csv=<property object at 0x0000000003ABE1D8> kind:property type:property class:<class ‘pyexcel.internal.meta.SheetMeta’>
4 csvz=<property object at 0x0000000003ABAF48> kind:property type:property class:<class ‘pyexcel.internal.meta.SheetMeta’>
5 dict=<property object at 0x0000000003AC4D18> kind:property type:property class:<class ‘pyexcel.internal.meta.SheetMeta’>
6 html=<property object at 0x0000000003ABE6D8> kind:property type:property class:<class ‘pyexcel.internal.meta.SheetMeta’>
7 ods=<property object at 0x0000000003ABE0E8> kind:property type:property class:<class ‘pyexcel.internal.meta.SheetMeta’>
8 pdf=<property object at 0x0000000003ABE4F8> kind:property type:property class:<class ‘pyexcel.internal.meta.SheetMeta’>
9 queryset=<property object at 0x0000000003ABE228> kind:property type:property class:<class ‘pyexcel.internal.meta.SheetMeta’>
10 records=<property object at 0x0000000003ACD138> kind:property type:property class:<class ‘pyexcel.internal.meta.SheetMeta’>
11 texttable=<property object at 0x0000000003AC4778> kind:property type:property class:<class ‘pyexcel.internal.meta.SheetMeta’>
12 tsv=<property object at 0x0000000003ABE9A8> kind:property type:property class:<class ‘pyexcel.internal.meta.SheetMeta’>
13 tsvz=<property object at 0x0000000003ABE5E8> kind:property type:property class:<class ‘pyexcel.internal.meta.SheetMeta’>
14 url=<property object at 0x0000000003AA6F98> kind:property type:property class:<class ‘pyexcel.internal.meta.SheetMeta’>
15 xls=<property object at 0x0000000003ABE318> kind:property type:property class:<class ‘pyexcel.internal.meta.SheetMeta’>
16 xlsb=<property object at 0x0000000003ABE8B8> kind:property type:property class:<class ‘pyexcel.internal.meta.SheetMeta’>
17 xlsm=<property object at 0x0000000003ABE408> kind:property type:property class:<class ‘pyexcel.internal.meta.SheetMeta’>
18 xlsx=<property object at 0x0000000003ABE7C8> kind:property type:property class:<class ‘pyexcel.internal.meta.SheetMeta’>
method
19 get_array()
kind=method class=SheetMeta objtype=function
获取数组格式的数据
20 get_bookdict()
kind=method class=SheetMeta objtype=function
获取手册格式的数据
21 get_csv()
kind=method class=SheetMeta objtype=function
获取csv格式的数据
22 get_csvz()
kind=method class=SheetMeta objtype=function
获取csv格式的数据
23 get_dict()
kind=method class=SheetMeta objtype=function
获取dict格式的数据
24 get_html()
kind=method class=SheetMeta objtype=function
HTML getter没有定义。
25 get_ods()
kind=method class=SheetMeta objtype=function
获取ods格式的数据
26 get_pdf()
kind=method class=SheetMeta objtype=function
没有定义PDF getter。
27 get_queryset()
kind=method class=SheetMeta objtype=function
未定义Queryset getter。
28 get_records()
kind=method class=SheetMeta objtype=function
以记录格式获取数据
29 get_texttable()
kind=method class=SheetMeta objtype=function
获取文本格式的数据
30 get_tsv()
kind=method class=SheetMeta objtype=function
获取tsv格式的数据
31 get_tsvz()
kind=method class=SheetMeta objtype=function
获取tsvz格式的数据
32 get_url()
kind=method class=SheetMeta objtype=function
Url getter没有定义。
33 get_xls()
kind=method class=SheetMeta objtype=function
获取xls格式的数据
34 get_xlsb()
kind=method class=SheetMeta objtype=function
XLSB getter没有定义。
35 get_xlsm()
kind=method class=SheetMeta objtype=function
获取xlsm格式的数据
36 get_xlsx()
kind=method class=SheetMeta objtype=function
获取xlsx格式的数据
37 save_as(self, filename, **keywords)
kind=method class=SheetMeta objtype=function line:258 at …\lib\site-packages\pyexcel\internal\meta.py
将内容保存到已命名文件。
关键字可能会根据您的文件类型而有所不同,因为相关的文件类型使用不同的库。
**参数**
filename: 一个文件路径
library: 选择一个特定的pyexcel-io插件来写入
renderer_library: 选择一个pyexcel解析器插件来写入
> 参见:** csv文件格式相关参数 **
> 【pyexcel.docstrings.keywords】/常量/str/1 CSV_PARAMS
38 save_to_database(
kind=method class=SheetMeta objtype=function line:287 at …\lib\site-packages\pyexcel\internal\meta.py
将表中的数据保存到数据库表:
:param session: 数据库会话
:param table: 数据库表
:param initializer: 表的初始化函数
:param mapdict: 数据列的自定义映射字典
:param auto_commit: 默认情况下,数据是自动提交的。
39 save_to_django_model(
kind=method class=SheetMeta objtype=function line:268 at …\lib\site-packages\pyexcel\internal\meta.py
通过django保存到数据库表
:param model: 一个数据库模型
:param initializer: 模型的初始化函数
:param mapdict: 数据列的自定义映射字典
:param batch_size: 关于批量插入大小的参数
40 save_to_memory(self, file_type, stream=None, **keywords)
kind=method class=SheetMeta objtype=function line:262 at …\lib\site-packages\pyexcel\internal\meta.py
41 set_array()
kind=method class=SheetMeta objtype=function
以数组格式设置数据
42 set_bookdict()
kind=method class=SheetMeta objtype=function
按手册格式设置数据
43 set_csv()
kind=method class=SheetMeta objtype=function
按csv格式设置数据
44 set_csvz()
kind=method class=SheetMeta objtype=function
设置为csv格式
45 set_dict()
kind=method class=SheetMeta objtype=function
设置数据为dict格式
46 set_html()
kind=method class=SheetMeta objtype=function
以html格式设置数据
47 set_ods()
kind=method class=SheetMeta objtype=function
设置为ods格式
48 set_pdf()
kind=method class=SheetMeta objtype=function
设置pdf格式的数据
49 set_queryset()
kind=method class=SheetMeta objtype=function
以queryset格式设置数据
50 set_records()
kind=method class=SheetMeta objtype=function
设置数据为记录格式
51 set_texttable()
kind=method class=SheetMeta objtype=function
textttable setter没有定义。
52 set_tsv()
kind=method class=SheetMeta objtype=function
以tsv格式设置数据
53 set_tsvz()
kind=method class=SheetMeta objtype=function
设置数据为tsvz格式
54 set_url()
kind=method class=SheetMeta objtype=function
设置url格式的数据
55 set_xls()
kind=method class=SheetMeta objtype=function
设置格式为xls
56 set_xlsb()
kind=method class=SheetMeta objtype=function
设置xlsb格式的数据
57 set_xlsm()
kind=method class=SheetMeta objtype=function
使用xlsm格式设置数据
58 set_xlsx()
kind=method class=SheetMeta objtype=function
设置格式为xlsx
class method
59 register_input()
kind=class method class=SheetMeta objtype=classmethod
classmethod(function) -> method转换函数为类方法。
60 register_io()
kind=class method class=SheetMeta objtype=classmethod
classmethod(function) -> method转换函数为类方法。
61 register_presentation()
kind=class method class=SheetMeta objtype=classmethod
classmethod(function) -> method转换函数为类方法。
20 pyexcel.internal.meta.BookMeta
BookMeta, pyexcel.internal.meta.BookMeta, module=pyexcel.internal.meta, line:309 at site-packages\pyexcel\internal\meta.py
注释工作簿属性
property
1 array=<property object at 0x0000000003ACD0E8> kind:property type:property class:<class ‘pyexcel.internal.meta.BookMeta’>
2 bookdict=<property object at 0x0000000003AC4B38> kind:property type:property class:<class ‘pyexcel.internal.meta.BookMeta’>
3 csv=<property object at 0x0000000003ABEC78> kind:property type:property class:<class ‘pyexcel.internal.meta.BookMeta’>
4 csvz=<property object at 0x0000000003ABEA98> kind:property type:property class:<class ‘pyexcel.internal.meta.BookMeta’>
5 dict=<property object at 0x0000000003AC4DB8> kind:property type:property class:<class ‘pyexcel.internal.meta.BookMeta’>
6 html=<property object at 0x0000000003AC4278> kind:property type:property class:<class ‘pyexcel.internal.meta.BookMeta’>
7 ods=<property object at 0x0000000003ABEB88> kind:property type:property class:<class ‘pyexcel.internal.meta.BookMeta’>
8 pdf=<property object at 0x0000000003AC4098> kind:property type:property class:<class ‘pyexcel.internal.meta.BookMeta’>
9 queryset=<property object at 0x0000000003ABED68> kind:property type:property class:<class ‘pyexcel.internal.meta.BookMeta’>
10 records=<property object at 0x0000000003ACD2C8> kind:property type:property class:<class ‘pyexcel.internal.meta.BookMeta’>
11 texttable=<property object at 0x0000000003AC48B8> kind:property type:property class:<class ‘pyexcel.internal.meta.BookMeta’>
12 tsv=<property object at 0x0000000003AC4548> kind:property type:property class:<class ‘pyexcel.internal.meta.BookMeta’>
13 tsvz=<property object at 0x0000000003AC4188> kind:property type:property class:<class ‘pyexcel.internal.meta.BookMeta’>
14 url=<property object at 0x0000000003ABAE58> kind:property type:property class:<class ‘pyexcel.internal.meta.BookMeta’>
15 xls=<property object at 0x0000000003ABEE58> kind:property type:property class:<class ‘pyexcel.internal.meta.BookMeta’>
16 xlsb=<property object at 0x0000000003AC4458> kind:property type:property class:<class ‘pyexcel.internal.meta.BookMeta’>
17 xlsm=<property object at 0x0000000003ABEF48> kind:property type:property class:<class ‘pyexcel.internal.meta.BookMeta’>
18 xlsx=<property object at 0x0000000003AC4368> kind:property type:property class:<class ‘pyexcel.internal.meta.BookMeta’>
method
19 get_array()
kind=method class=BookMeta objtype=function
获取数组格式的数据
20 get_bookdict()
kind=method class=BookMeta objtype=function
获取手册格式的数据
21 get_csv()
kind=method class=BookMeta objtype=function
获取csv格式的数据
22 get_csvz()
kind=method class=BookMeta objtype=function
获取csv格式的数据
23 get_dict()
kind=method class=BookMeta objtype=function
获取dict格式的数据
24 get_html()
kind=method class=BookMeta objtype=function
HTML getter没有定义。
25 get_ods()
kind=method class=BookMeta objtype=function
获取ods格式的数据
26 get_pdf()
kind=method class=BookMeta objtype=function
没有定义PDF getter。
27 get_queryset()
kind=method class=BookMeta objtype=function
未定义Queryset getter。
28 get_records()
kind=method class=BookMeta objtype=function
以记录格式获取数据
29 get_texttable()
kind=method class=BookMeta objtype=function
获取文本格式的数据
30 get_tsv()
kind=method class=BookMeta objtype=function
获取tsv格式的数据
31 get_tsvz()
kind=method class=BookMeta objtype=function
获取tsvz格式的数据
32 get_url()
kind=method class=BookMeta objtype=function
Url getter没有定义。
33 get_xls()
kind=method class=BookMeta objtype=function
获取xls格式的数据
34 get_xlsb()
kind=method class=BookMeta objtype=function
XLSB getter没有定义。
35 get_xlsm()
kind=method class=BookMeta objtype=function
获取xlsm格式的数据
36 get_xlsx()
kind=method class=BookMeta objtype=function
获取xlsx格式的数据
37 save_as(self, filename, **keywords)
kind=method class=BookMeta objtype=function line:317 at …\lib\site-packages\pyexcel\internal\meta.py
将内容保存到新文件关键字可能根据您的文件类型而有所不同,因为相关的文件类型使用不同的库。
(见前)
38 save_to_database(
kind=method class=BookMeta objtype=function line:367 at …\lib\site-packages\pyexcel\internal\meta.py
将表中的数据保存到数据库表。(sheets-->table)
:param session: 数据库会话
:param tables: 一个数据库表的列表,被:meth: ' Sheet.save_to_database '接受。
当表之间存在依赖关系时,表的顺序很重要。
例如,**Car**是由**Car Maker**制造的。**Car**表前应注明**Car**表。
:param initializers: 表的初始化函数列表和序列应该匹配表,
:param mapdicts: 数据列的自定义映射字典和序列应该匹配表
:param auto_commit: 缺省情况下,提交数据。
39 save_to_django_models(
kind=method class=BookMeta objtype=function line:337 at …\lib\site-packages\pyexcel\internal\meta.py
通过 django 模型保存数据表
:param models: 一个数据库模型列表,被:meth:'Sheet.save_to_django_model'接受。
当表之间存在依赖关系时,表的顺序很重要。
例如,**Car**是由**Car Maker**制造的。**Car**表前应注明**Car**表。
:param initializers: 表的初始化函数列表和序列应该匹配表
:param mapdicts: 数据列的自定义映射字典和序列应该匹配表
optional parameters:
:param batch_size: django bulk_create 批大小
:param bulk_save: 是使用bulk_create还是每个记录使用单个保存
40 save_to_memory(self, file_type, stream=None, **keywords)
kind=method class=BookMeta objtype=function line:323 at …\lib\site-packages\pyexcel\internal\meta.py
将内容保存到内存流
:param file_type: 流的格式是什么
:param stream: 内存流。注意在python3中,对于csv和tsv格式,请传递一个StringIO实例。
对于xls、xlsx和ods,是BytesIO的一个实例。
41 set_array()
kind=method class=BookMeta objtype=function
以数组格式设置数据
42 set_bookdict()
kind=method class=BookMeta objtype=function
按手册格式设置数据
43 set_csv()
kind=method class=BookMeta objtype=function
按csv格式设置数据
44 set_csvz()
kind=method class=BookMeta objtype=function
设置为csv格式
45 set_dict()
kind=method class=BookMeta objtype=function
设置数据为dict格式
46 set_html()
kind=method class=BookMeta objtype=function
以html格式设置数据
47 set_ods()
kind=method class=BookMeta objtype=function
设置为ods格式
48 set_pdf()
kind=method class=BookMeta objtype=function
设置pdf格式的数据
49 set_queryset()
kind=method class=BookMeta objtype=function
以queryset格式设置数据
50 set_records()
kind=method class=BookMeta objtype=function
设置数据为记录格式
51 set_texttable()
kind=method class=BookMeta objtype=function
textttable setter没有定义。
52 set_tsv()
kind=method class=BookMeta objtype=function
以tsv格式设置数据
53 set_tsvz()
kind=method class=BookMeta objtype=function
设置数据为tsvz格式
54 set_url()
kind=method class=BookMeta objtype=function
设置url格式的数据
55 set_xls()
kind=method class=BookMeta objtype=function
设置格式为xls
56 set_xlsb()
kind=method class=BookMeta objtype=function
设置xlsb格式的数据
57 set_xlsm()
kind=method class=BookMeta objtype=function
使用xlsm格式设置数据
58 set_xlsx()
kind=method class=BookMeta objtype=function
设置格式为xlsx
class method
59 register_input()
kind=class method class=BookMeta objtype=classmethod
classmethod(function) -> method转换函数为类方法。
60 register_io()
kind=class method class=BookMeta objtype=classmethod
classmethod(function) -> method转换函数为类方法。
61 register_presentation()
kind=class method class=BookMeta objtype=classmethod
classmethod(function) -> method 转换函数为类方法。
私有或局部
21 _get_book <function _get_book at 0x0000000003AB8048>
剩余
22 loader <frozen_importlib_external.SourceFileLoader object at 0x0000000003AAA7C8>
23 spec ModuleSpec(name=‘pyexcel.internal.meta’, loader=<frozen_importlib_external.SourceFileLoader object at 0x0000000003AAA7C8>, origin=‘…\lib\site-packages\pyexcel\internal\meta.py’)
24 SOURCE <pyexcel.internal.source_plugin.SourcePluginManager object at 0x0000000003A65B08>
25 REGISTER_PRESENTATION functools.partial(<function attribute at 0x0000000003AB7F78>, getter_func=<function sheet_presenter at 0x0000000003AB7C18>, description='\nGet data in {0} format\n\nYou could obtain content in {0} format by dot notation::\n\n {1}.{0}\n\nif you need to pass on more parameters, you could use::\n\n {1}.get{0}(**keywords)\n’)
26 REGISTER_BOOK_PRESENTATION functools.partial(<function attribute at 0x0000000003AB7F78>, getter_func=<function book_presenter at 0x0000000003AB7DC8>, instance_name=‘Book’, description='\nGet data in {0} format\n\nYou could obtain content in {0} format by dot notation::\n\n {1}.{0}\n\nif you need to pass on more parameters, you could use::\n\n {1}.get{0}(**keywords)\n’)
27 REGISTER_INPUT functools.partial(<function attribute at 0x0000000003AB7F78>, setter_func=<function importer at 0x0000000003AB7E58>, description=‘\nSet data in {0} format\n\nYou could set content in {0} format by dot notation::\n\n {1}.{0}\n\nif you need to pass on more parameters, you could use::\n\n {1}.set_{0}(the_io_stream_in_{0}format, **keywords)\n’)
28 REGISTER_BOOK_INPUT functools.partial(<function attribute at 0x0000000003AB7F78>, instance_name=‘Book’, setter_func=<function book_importer at 0x0000000003AB7EE8>, description='\nSet data in {0} format\n\nYou could set content in {0} format by dot notation::\n\n {1}.{0}\n\nif you need to pass on more parameters, you could use::\n\n {1}.set{0}(the_io_stream_in_{0}format, **keywords)\n’)
29 REGISTER_IO functools.partial(<function attribute at 0x0000000003AB7F78>, getter_func=<function sheet_presenter at 0x0000000003AB7C18>, setter_func=<function importer at 0x0000000003AB7E58>, description='\nGet/Set data in/from {0} format\n\nYou could obtain content in {0} format by dot notation::\n\n {1}.{0}\n\nAnd you could as well set content by dot notation::\n\n {1}.{0} = the_io_stream_in{0}format\n\nif you need to pass on more parameters, you could use::\n\n {1}.get{0}(**keywords)\n {1}.set_{0}(the_io_stream_in_{0}format, **keywords)\n’)
30 REGISTER_BOOK_IO functools.partial(<function attribute at 0x0000000003AB7F78>, getter_func=<function book_presenter at 0x0000000003AB7DC8>, setter_func=<function book_importer at 0x0000000003AB7EE8>, instance_name=‘Book’, description='\nGet/Set data in/from {0} format\n\nYou could obtain content in {0} format by dot notation::\n\n {1}.{0}\n\nAnd you could as well set content by dot notation::\n\n {1}.{0} = the_io_stream_in{0}format\n\nif you need to pass on more parameters, you could use::\n\n {1}.get{0}(**keywords)\n {1}.set_{0}(the_io_stream_in_{0}_format, **keywords)\n’)
【pyexcel.internal.sheets】
sheets, fullname=pyexcel.internal.sheets, file=pyexcel\internal\sheets_init_.py
pyexcel.internal.sheets
pyexcel的核心功能,数据模型。
统计
序号 | 类别 | 数量 |
---|---|---|
4 | str | 5 |
6 | list | 1 |
8 | dict | 1 |
9 | module | 6 |
10 | class | 3 |
11 | function | 1 |
13 | residual | 2 |
14 | system | 9 |
15 | private | 1 |
16 | all | 19 |
常量
模块
1 pyexcel.internal.sheets.formatters
formatters, fullname=pyexcel.internal.sheets.formatters, file=pyexcel\internal\sheets\formatters.py
pyexcel.formatters
这些实用程序有助于格式化内容。
2 pyexcel.internal.sheets._shared
_shared, fullname=pyexcel.internal.sheets._shared, file=pyexcel\internal\sheets_shared.py
pyexcel.internal.sheets._shared
本地共享的实用函数
3 pyexcel.internal.sheets.row
row, fullname=pyexcel.internal.sheets.row, file=pyexcel\internal\sheets\row.py
pyexcel.internal.sheets.row
通用表行
4 pyexcel.internal.sheets.column
column, fullname=pyexcel.internal.sheets.column, file=pyexcel\internal\sheets\column.py
pyexcel.internal.sheets.column
通用表列
5 pyexcel.internal.sheets.extended_list
extended_list, fullname=pyexcel.internal.sheets.extended_list, file=pyexcel\internal\sheets\extended_list.py
6 pyexcel.internal.sheets.matrix
matrix, fullname=pyexcel.internal.sheets.matrix, file=pyexcel\internal\sheets\matrix.py
pyexcel.internal.sheets.matrix
矩阵,一个数据模型,接受任何类型,电子表格样式的查找。
函数
7 transpose(in_array)
transpose(in_array), module=pyexcel.internal.sheets.matrix, line:827 at site-packages\pyexcel\internal\sheets\matrix.py
顺时针旋转90度,水平翻转第一列成为第一行。
:param list in_array: a list of arrays
翻转后为:
1 2 3 1 4
4 5 6 7 -> 2 5
3 6
'' 7
类
8 pyexcel.internal.sheets.row.Row
Row, pyexcel.internal.sheets.row.Row, module=pyexcel.internal.sheets.row, line:18 at site-packages\pyexcel\internal\sheets\row.py
表示矩阵的行。
.. table:: "example.csv"
= = =
1 2 3
4 5 6
7 8 9
= = =
上述列操作可以类似地在行上执行。本节将不重复相同的示例,而是展示一些高级用法。
>>> import pyexcel as pe
>>> data = [[1,2,3], [4,5,6], [7,8,9]]
>>> m = pe.internal.sheets.Matrix(data)
>>> m.row[0:2]
[[1, 2, 3], [4, 5, 6]]
>>> m.row[0:3] = [0, 0, 0]
>>> m.row[2]
[0, 0, 0]
>>> del m.row[0:2]
>>> m.row[0]
[0, 0, 0]
method
1 format(self, row_index=None, formatter=None, format_specs=None)
kind=method class=Row objtype=function line:239 at …\lib\site-packages\pyexcel\internal\sheets\row.py
格式化行
2 select(self, indices)
kind=method class=Row objtype=function line:47 at …\lib\site-packages\pyexcel\internal\sheets\row.py
删除指定以外的行索引
例子:
>>> import pyexcel as pe
>>> data = [[1],[2],[3],[4],[5],[6],[7],[9]]
>>> sheet = pe.Sheet(data)
>>> sheet
pyexcel sheet:
+---+
| 1 |
+---+
| 2 |
+---+
| 3 |
+---+
| 4 |
+---+
| 5 |
+---+
| 6 |
+---+
| 7 |
+---+
| 9 |
+---+
>>> sheet.row.select([1,2,3,5])
>>> sheet
pyexcel sheet:
+---+
| 2 |
+---+
| 3 |
+---+
| 4 |
+---+
| 6 |
+---+
9 pyexcel.internal.sheets.column.Column
Column, pyexcel.internal.sheets.column.Column, module=pyexcel.internal.sheets.column, line:18 at site-packages\pyexcel\internal\sheets\column.py
表示矩阵的列
.. table:: "example.csv"
= = =
1 2 3
4 5 6
7 8 9
= = =
让我们对上述数据矩阵上的数据列进行操作:
>>> import pyexcel as pe
>>> data = [[1,2,3], [4,5,6], [7,8,9]]
>>> m = pe.internal.sheets.Matrix(data)
>>> m.column[0]
[1, 4, 7]
>>> m.column[2] = [0, 0, 0]
>>> m.column[2]
[0, 0, 0]
>>> del m.column[1]
>>> m.column[1]
[0, 0, 0]
>>> m.column[2]
Traceback (most recent call last):
...
IndexError
method
1 format(self, column_index=None, formatter=None, format_specs=None)
kind=method class=Column objtype=function line:296 at …\lib\site-packages\pyexcel\internal\sheets\column.py
格式化列
2 select(self, indices)
kind=method class=Column objtype=function line:49 at …\lib\site-packages\pyexcel\internal\sheets\column.py
例子:
>>> import pyexcel as pe
>>> data = [[1,2,3,4,5,6,7,9]]
>>> sheet = pe.Sheet(data)
>>> sheet
pyexcel sheet:
+---+---+---+---+---+---+---+---+
| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 9 |
+---+---+---+---+---+---+---+---+
>>> sheet.column.select([1,2,3,5])
>>> sheet
pyexcel sheet:
+---+---+---+---+
| 2 | 3 | 4 | 6 |
+---+---+---+---+
>>> data = [[1,2,3,4,5,6,7,9]]
>>> sheet = pe.Sheet(data)
>>> sheet
pyexcel sheet:
+---+---+---+---+---+---+---+---+
| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 9 |
+---+---+---+---+---+---+---+---+
>>> sheet.column.select([1,2,3,5])
>>> sheet
pyexcel sheet:
+---+---+---+---+
| 2 | 3 | 4 | 6 |
+---+---+---+---+
>>> data = [
... ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h'],
... [1,2,3,4,5,6,7,9],
... ]
>>> sheet = pe.Sheet(data, name_columns_by_row=0)
>>> sheet
pyexcel sheet:
+---+---+---+---+---+---+---+---+
| a | b | c | d | e | f | g | h |
+===+===+===+===+===+===+===+===+
| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 9 |
+---+---+---+---+---+---+---+---+
>>> del sheet.column['a', 'b', 'i', 'f'] # doctest:+ELLIPSIS
Traceback (most recent call last):
...
ValueError: ...
>>> sheet.column.select(['a', 'c', 'e', 'h'])
>>> sheet
pyexcel sheet:
+---+---+---+---+
| a | c | e | h |
+===+===+===+===+
| 1 | 3 | 5 | 9 |
+---+---+---+---+
10 pyexcel.internal.sheets.matrix.Matrix
Matrix, pyexcel.internal.sheets.matrix.Matrix, module=pyexcel.internal.sheets.matrix, line:27 at site-packages\pyexcel\internal\sheets\matrix.py
表数据的内部表示形式。每个元素可以是任何python类型
method
1 cell_value(self, row, column, new_value=None)
kind=method class=Matrix objtype=function line:78 at …\lib\site-packages\pyexcel\internal\sheets\matrix.py
对表单元格的随机访问:
:param int row: 从0开始的行索引
:param int column: 从0开始的列索引
:param any new_value: 新值:如果要设置值,则为新值
2 clone(self)
kind=method class=Matrix objtype=function line:772 at …\lib\site-packages\pyexcel\internal\sheets\matrix.py
3 column_at(self, index)
kind=method class=Matrix objtype=function line:183 at …\lib\site-packages\pyexcel\internal\sheets\matrix.py
获取指定列上的数据
4 column_range(self)
kind=method class=Matrix objtype=function line:72 at …\lib\site-packages\pyexcel\internal\sheets\matrix.py
效用函数得到列的范围
5 columns(self)
kind=method class=Matrix objtype=function line:652 at …\lib\site-packages\pyexcel\internal\sheets\matrix.py
返回一个从左到右的列迭代器。
.. 测试代码:
import pyexcel as pe
data = [
[1, 2, 3, 4],
[5, 6, 7, 8],
[9, 10, 11, 12]
]
m = pe.internal.sheets.Matrix(data)
print(list(m.columns()))
.. test输出:
[[1, 5, 9], [2, 6, 10], [3, 7, 11], [4, 8, 12]]
详情参见 :class:`ColumnIterator`
6 contains(self, predicate)
kind=method class=Matrix objtype=function line:487 at …\lib\site-packages\pyexcel\internal\sheets\matrix.py
表格里有东西吗
7 cut(self, topleft_corner, bottomright_corner)
kind=method class=Matrix objtype=function line:330 at …\lib\site-packages\pyexcel\internal\sheets\matrix.py
获取一个矩形形状的数据,并将该处数据清除。
:param slice topleft_corner: 矩形的左上角
:param slice bottomright_corner: 矩形的右下角
8 delete_columns(self, column_indices)
kind=method class=Matrix objtype=function line:450 at …\lib\site-packages\pyexcel\internal\sheets\matrix.py
根据指定的索引列表删除列
9 delete_rows(self, row_indices)
kind=method class=Matrix objtype=function line:172 at …\lib\site-packages\pyexcel\internal\sheets\matrix.py
删除指定的行索引
10 enumerate(self)
kind=method class=Matrix objtype=function line:513 at …\lib\site-packages\pyexcel\internal\sheets\matrix.py
从上到下,从左到右迭代一个单元格。
.. 测试代码:
>>> import pyexcel as pe
>>> data = [
... [1, 2, 3, 4],
... [5, 6, 7, 8],
... [9, 10, 11, 12]
... ]
>>> m = pe.internal.sheets.Matrix(data)
>>> print(list(m.enumerate()))
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
详情参见 :class:`HTLBRIterator`
11 extend_columns(self, columns)
kind=method class=Matrix objtype=function line:237 at …\lib\site-packages\pyexcel\internal\sheets\matrix.py
在最右边的列之后插入二维数据
Given::
s s s t t
Get::
s s s + t t
12 extend_columns_with_rows(self, rows)
kind=method class=Matrix objtype=function line:275 at …\lib\site-packages\pyexcel\internal\sheets\matrix.py
行被追加到最右边。
例子:
>>> import pyexcel as pe
>>> data = [
... [1],
... [2],
... [3]
... ]
>>> matrix = pe.Sheet(data)
>>> matrix
pyexcel sheet:
+---+
| 1 |
+---+
| 2 |
+---+
| 3 |
+---+
>>> rows = [
... [11, 11],
... [22, 22]
... ]
>>> matrix.extend_columns_with_rows(rows)
>>> matrix
pyexcel sheet:
+---+----+----+
| 1 | 11 | 11 |
+---+----+----+
| 2 | 22 | 22 |
+---+----+----+
| 3 | | |
+---+----+----+
13 extend_rows(self, rows)
kind=method class=Matrix objtype=function line:164 at …\lib\site-packages\pyexcel\internal\sheets\matrix.py
在底部行之后插入二维数据
14 filter(self, column_indices=None, row_indices=None)
kind=method class=Matrix objtype=function line:700 at …\lib\site-packages\pyexcel\internal\sheets\matrix.py
应用过滤器立即生效
15 format(self, formatter)
kind=method class=Matrix objtype=function line:707 at …\lib\site-packages\pyexcel\internal\sheets\matrix.py
为整个表应用格式化操作
例子:
>>> import pyexcel as pe
>>> # Given a dictinoary as the following
>>> data = {
... "1": [1, 2, 3, 4, 5, 6, 7, 8],
... "3": [1.25, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7, 8.8],
... "5": [2, 3, 4, 5, 6, 7, 8, 9],
... "7": [1, '',]
... }
>>> sheet = pe.get_sheet(adict=data)
>>> sheet.row[1]
[1, 1.25, 2, 1]
>>> sheet.format(str)
>>> sheet.row[1]
['1', '1.25', '2', '1']
>>> sheet.format(int)
>>> sheet.row[1]
[1, 1, 2, 1]
16 get_internal_array(self)
kind=method class=Matrix objtype=function line:51 at …\lib\site-packages\pyexcel\internal\sheets\matrix.py
当前内部阵列
17 map(self, custom_function)
kind=method class=Matrix objtype=function line:734 at …\lib\site-packages\pyexcel\internal\sheets\matrix.py
在工作表的所有单元格上执行一个函数
例子:
>>> import pyexcel as pe
>>> # Given a dictinoary as the following
>>> data = {
... "1": [1, 2, 3, 4, 5, 6, 7, 8],
... "3": [1.25, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7, 8.8],
... "5": [2, 3, 4, 5, 6, 7, 8, 9],
... "7": [1, '',]
... }
>>> sheet = pe.get_sheet(adict=data)
>>> sheet.row[1]
[1, 1.25, 2, 1]
>>> inc = lambda value: (float(value) if value != '' else 0)+1
>>> sheet.map(inc)
>>> sheet.row[1]
[2.0, 2.25, 3.0, 2.0]
18 number_of_columns(self)
kind=method class=Matrix objtype=function line:59 at …\lib\site-packages\pyexcel\internal\sheets\matrix.py
列数
19 number_of_rows(self)
kind=method class=Matrix objtype=function line:55 at …\lib\site-packages\pyexcel\internal\sheets\matrix.py
行数
20 paste(self, topleft_corner, rows=None, columns=None)
kind=method class=Matrix objtype=function line:343 at …\lib\site-packages\pyexcel\internal\sheets\matrix.py
将一个矩形形状的数据粘贴在一个位置后。
:param slice topleft_corner: 矩形的左上角
例子:
>>> import pyexcel as pe
>>> data = [
... # 0 1 2 3 4 5 6
... [1, 2, 3, 4, 5, 6, 7], # 0
... [21, 22, 23, 24, 25, 26, 27],
... [31, 32, 33, 34, 35, 36, 37],
... [41, 42, 43, 44, 45, 46, 47],
... [51, 52, 53, 54, 55, 56, 57] # 4
... ]
>>> s = pe.Sheet(data)
>>> # cut 1<= row < 4, 1<= column < 5
>>> data = s.cut([1, 1], [4, 5])
>>> s.paste([4,6], rows=data)
>>> s
pyexcel sheet:
+----+----+----+----+----+----+----+----+----+----+
| 1 | 2 | 3 | 4 | 5 | 6 | 7 | | | |
+----+----+----+----+----+----+----+----+----+----+
| 21 | | | | | 26 | 27 | | | |
+----+----+----+----+----+----+----+----+----+----+
| 31 | | | | | 36 | 37 | | | |
+----+----+----+----+----+----+----+----+----+----+
| 41 | | | | | 46 | 47 | | | |
+----+----+----+----+----+----+----+----+----+----+
| 51 | 52 | 53 | 54 | 55 | 56 | 22 | 23 | 24 | 25 |
+----+----+----+----+----+----+----+----+----+----+
| | | | | | | 32 | 33 | 34 | 35 |
+----+----+----+----+----+----+----+----+----+----+
| | | | | | | 42 | 43 | 44 | 45 |
+----+----+----+----+----+----+----+----+----+----+
>>> s.paste([6,9], columns=data)
>>> s
pyexcel sheet:
+----+----+----+----+----+----+----+----+----+----+----+----+
| 1 | 2 | 3 | 4 | 5 | 6 | 7 | | | | | |
+----+----+----+----+----+----+----+----+----+----+----+----+
| 21 | | | | | 26 | 27 | | | | | |
+----+----+----+----+----+----+----+----+----+----+----+----+
| 31 | | | | | 36 | 37 | | | | | |
+----+----+----+----+----+----+----+----+----+----+----+----+
| 41 | | | | | 46 | 47 | | | | | |
+----+----+----+----+----+----+----+----+----+----+----+----+
| 51 | 52 | 53 | 54 | 55 | 56 | 22 | 23 | 24 | 25 | | |
+----+----+----+----+----+----+----+----+----+----+----+----+
| | | | | | | 32 | 33 | 34 | 35 | | |
+----+----+----+----+----+----+----+----+----+----+----+----+
| | | | | | | 42 | 43 | 44 | 22 | 32 | 42 |
+----+----+----+----+----+----+----+----+----+----+----+----+
| | | | | | | | | | 23 | 33 | 43 |
+----+----+----+----+----+----+----+----+----+----+----+----+
| | | | | | | | | | 24 | 34 | 44 |
+----+----+----+----+----+----+----+----+----+----+----+----+
| | | | | | | | | | 25 | 35 | 45 |
+----+----+----+----+----+----+----+----+----+----+----+----+
21 rcolumns(self)
kind=method class=Matrix objtype=function line:676 at …\lib\site-packages\pyexcel\internal\sheets\matrix.py
返回一个从右到左的列迭代器示例。
例子:
import pyexcel as pe
data = [
[1, 2, 3, 4],
[5, 6, 7, 8],
[9, 10, 11, 12]
]
m = pe.internal.sheets.Matrix(data)
print(pe.utils.to_array(m.rcolumns()))
输出:
[[4, 8, 12], [3, 7, 11], [2, 6, 10], [1, 5, 9]]
详情参见 :class:`ColumnReverseIterator`
22 region(self, topleft_corner, bottomright_corner)
kind=method class=Matrix objtype=function line:313 at …\lib\site-packages\pyexcel\internal\sheets\matrix.py
获取矩形形状的数据
:param slice topleft_corner: 矩形的左上角
:param slice bottomright_corner: 矩形的右下角
23 reverse(self)
kind=method class=Matrix objtype=function line:533 at …\lib\site-packages\pyexcel\internal\sheets\matrix.py
相反,从下到上,从右到左依次枚举每个单元格。
例子:
>>> import pyexcel as pe
>>> data = [
... [1, 2, 3, 4],
... [5, 6, 7, 8],
... [9, 10, 11, 12]
... ]
>>> m = pe.internal.sheets.Matrix(data)
>>> print(list(m.reverse()))
[12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]
详情参见 :class:`HBRTLIterator`
24 row_at(self, index)
kind=method class=Matrix objtype=function line:98 at …\lib\site-packages\pyexcel\internal\sheets\matrix.py
获取指定行的数据
25 row_range(self)
kind=method class=Matrix objtype=function line:66 at …\lib\site-packages\pyexcel\internal\sheets\matrix.py
实用函数来获取行范围
26 rows(self)
kind=method class=Matrix objtype=function line:604 at …\lib\site-packages\pyexcel\internal\sheets\matrix.py
返回一个从上到下行的迭代器
例子:
import pyexcel as pe
data = [
[1, 2, 3, 4],
[5, 6, 7, 8],
[9, 10, 11, 12]
]
m = pe.internal.sheets.Matrix(data)
print(pe.utils.to_array(m.rows()))
输出:
[[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]]
详情参见 :class:`RowIterator`
27 rrows(self)
kind=method class=Matrix objtype=function line:628 at …\lib\site-packages\pyexcel\internal\sheets\matrix.py
返回一个从下到上的行迭代器。
.. 测试代码:
import pyexcel as pe
data = [
[1, 2, 3, 4],
[5, 6, 7, 8],
[9, 10, 11, 12]
]
m = pe.internal.sheets.Matrix(data)
print(pe.utils.to_array(m.rrows()))
.. test输出:
[[9, 10, 11, 12], [5, 6, 7, 8], [1, 2, 3, 4]]
详情参见 :class:`RowReverseIterator`
28 rvertical(self)
kind=method class=Matrix objtype=function line:579 at …\lib\site-packages\pyexcel\internal\sheets\matrix.py
默认迭代器从最右的列到最左的行,从下到上逐个遍历每个单元格。
例子:
import pyexcel as pe
data = [
[1, 2, 3, 4],
[5, 6, 7, 8],
[9, 10, 11, 12]
]
m = pe.internal.sheets.Matrix(data)
print(pe.utils.to_array(m.rvertical())
输出:
[12, 8, 4, 11, 7, 3, 10, 6, 2, 9, 5, 1]
详情参见 :class:`VBRTLIterator`
29 set_column_at(self, column_index, data_array, starting=0)
kind=method class=Matrix objtype=function line:202 at …\lib\site-packages\pyexcel\internal\sheets\matrix.py
更新列数据范围。
如果调用像以下这样则:
set_column_at(2, ['N','N', 'N'], 1)::
+--> column_index = 2
|
A B C
1 3 N <- starting = 1
2 4 N
此函数不会将元素设置在当前表范围之外。
:param int column_index: 需要修改哪一列
:param list data_array: 一维阵列
:param int staring: 从哪个索引进行更新
:raises IndexError: 如果column_index超过列范围或起始位置超过行范围
30 set_row_at(self, row_index, data_array)
kind=method class=Matrix objtype=function line:113 at …\lib\site-packages\pyexcel\internal\sheets\matrix.py
更新行数据范围
31 to_array(self)
kind=method class=Matrix objtype=function line:502 at …\lib\site-packages\pyexcel\internal\sheets\matrix.py
得到一个数组
32 transpose(self)
kind=method class=Matrix objtype=function line:494 at …\lib\site-packages\pyexcel\internal\sheets\matrix.py
将数据表旋转90度
33 vertical(self)
kind=method class=Matrix objtype=function line:556 at …\lib\site-packages\pyexcel\internal\sheets\matrix.py
默认迭代器逐一遍历每个单元格,从最左列到最右行,从上到下示例。
例子:
import pyexcel as pe
data = [
[1, 2, 3, 4],
[5, 6, 7, 8],
[9, 10, 11, 12]
]
m = pe.internal.sheets.Matrix(data)
print(list(m.vertical()))
输出:
[1, 5, 9, 2, 6, 10, 3, 7, 11, 4, 8, 12]
详情参见 :class:`VTLBRIterator`
私有或局部
11 _shared <module ‘pyexcel.internal.sheets._shared’ from ‘…\lib\site-packages\pyexcel\internal\sheets\_shared.py’>
【pyexcel.internal.garbagecollector】
garbagecollector, fullname=pyexcel.internal.garbagecollector, file=pyexcel\internal\garbagecollector.py
pyexcel.internal.garbagecollector
简单垃圾收集器
统计
序号 | 类别 | 数量 |
---|---|---|
4 | str | 5 |
6 | list | 1 |
8 | dict | 1 |
9 | module | 1 |
11 | function | 4 |
13 | residual | 2 |
14 | system | 8 |
16 | all | 14 |
常量
list
1 GARBAGE []
模块
2 pyexcel.docstrings
docstrings, fullname=pyexcel.docstrings, file=pyexcel\docstrings_init_.py
函数
3 append_doc(value)
append_doc(value), module=pyexcel._compact, line:68 at site-packages\pyexcel_compact.py
4 append(item)
append(item), module=pyexcel.internal.garbagecollector, line:16 at site-packages\pyexcel\internal\garbagecollector.py
将garbage添加到全局垃圾列表
5 free_resources()
free_resources(), module=pyexcel.internal.garbagecollector, line:24 at site-packages\pyexcel\internal\garbagecollector.py
关闭以'i'开头的签名函数打开的文件句柄。
对于csv, csvz文件格式,文件句柄将保持打开状态。
对于xls、ods文件格式,文件将全部读入内存,然后关闭。
对于xlsx,文件句柄在python 2.7 - 3.5中 通过pyexcel-xlsx(openpyxl)保持打开状态。
换句话说,pyexcel-xls、pyexcel-ods、pyexcel-ods3 不会泄露文件句柄。
6 reset()
reset(), module=pyexcel.internal.garbagecollector, line:35 at site-packages\pyexcel\internal\garbagecollector.py
在所有东西都关闭之后,重置数组
【copy】
copy, fullname=copy, file=copy.py
【re】
re, fullname=re, file=re.py
【pyexcel_io.manager】
manager, fullname=pyexcel_io.manager, file=pyexcel_io\manager.py
pyexcel_io.manager
控制文件流
统计
序号 | 类别 | 数量 |
---|---|---|
4 | str | 5 |
5 | tuple | 1 |
6 | list | 2 |
8 | dict | 2 |
10 | class | 2 |
11 | function | 4 |
13 | residual | 2 |
14 | system | 8 |
16 | all | 18 |
常量
tuple
1 FILE_TYPES (‘csv’, ‘tsv’, ‘csv’, ‘tsv’, ‘csv’, ‘tsv’, ‘csvz’, ‘csvz’, ‘tsvz’, ‘tsvz’, ‘csvz’, ‘tsvz’, ‘csv’, ‘csv’, ‘tsv’, ‘tsv’, '…
list
2 TEXT_STREAM_TYPES [‘csv’, ‘csv’, ‘tsv’, ‘tsv’, ‘csv’, ‘csv’, ‘tsv’, ‘tsv’, ‘csv’, ‘csv’, ‘tsv’, ‘tsv’, ‘csv’, ‘csv’, ‘csv’, ‘csv’, ‘tsv’, …
3 BINARY_STREAM_TYPES [‘csvz’, ‘csvz’, ‘csvz’, ‘csvz’, ‘tsvz’, ‘tsvz’, ‘tsvz’, ‘tsvz’, ‘csvz’, ‘csvz’, ‘tsvz’, ‘tsvz’, ‘csvz’, ‘csvz’, ‘csvz’,…
dict
4 MIME_TYPES {}
函数
5 register_stream_type(file_type, stream_type)
register_stream_type(file_type, stream_type), module=pyexcel_io.manager, line:18 at site-packages\pyexcel_io\manager.py
跟踪不同文件格式的流类型
6 get_io(file_type)
get_io(file_type), module=pyexcel_io.manager, line:28 at site-packages\pyexcel_io\manager.py
一个实用函数,帮助您生成正确的io流。
:param file_type: 支持的文件类型
:returns: 适当的io流,否则为None
7 get_io_type(file_type)
get_io_type(file_type), module=pyexcel_io.manager, line:48 at site-packages\pyexcel_io\manager.py
一个实用函数,帮助您生成正确的io流。
:param file_type: 支持的文件类型
:returns: 适当的io流,否则为None
8 register_a_file_type(file_type, stream_type, mime_type)
register_a_file_type(file_type, stream_type, mime_type), module=pyexcel_io.manager, line:68 at site-packages\pyexcel_io\manager.py
跟踪这个库支持的文件格式
类
9 _io.BytesIO
BytesIO, _io.BytesIO, module=_io, line:0 at
9 _io.StringIO
StringIO, _io.StringIO, module=_io, line:0 at
【os】
os, fullname=os, file=os.py
【pyexcel_io.constants】
constants, fullname=pyexcel_io.constants, file=pyexcel_io\constants.py
pyexcel_io.constants
pyexcel中出现的常量
统计
序号 | 类别 | 数量 |
---|---|---|
1 | int | 4 |
4 | str | 44 |
8 | dict | 1 |
13 | residual | 2 |
14 | system | 8 |
16 | all | 51 |
常量
int
1 SKIP_DATA -1
2 TAKE_DATA 0
3 STOP_ITERATION 1
4 MAX_INTEGER 999999999999999
str
5 DEFAULT_NAME pyexcel
6 DEFAULT_SHEET_NAME pyexcel_sheet1
7 DEFAULT_PLUGIN_NAME pyexcel_io_plugins
8 MESSAGE_INVALID_PARAMETERS Invalid parameters
9 MESSAGE_ERROR_02 No content, file name. Nothing is given
10 MESSAGE_ERROR_03 cannot handle unknown content
11 MESSAGE_WRONG_IO_INSTANCE Wrong io instance is passed for your file format.
12 MESSAGE_FILE_NAME_SHOULD_BE_STRING file_name should be a string
13 MESSAGE_CANNOT_WRITE_STREAM_FORMATTER Cannot write content of file type %s to stream
14 MESSAGE_CANNOT_READ_STREAM_FORMATTER Cannot read content of file type %s from stream
15 MESSAGE_CANNOT_WRITE_FILE_TYPE_FORMATTER Cannot write content of file type %s to file %s
16 MESSAGE_CANNOT_READ_FILE_TYPE_FORMATTER Cannot read content of file type %s from file %s
17 MESSAGE_LOADING_FORMATTER The plugin for file type %s is not installed. Please install %s
18 MESSAGE_NOT_FILE_FORMATTER %s is not a file
19 MESSAGE_FILE_DOES_NOT_EXIST %s does not exist
20 MESSAGE_EMPTY_ARRAY One empty row is found
21 MESSAGE_IGNORE_ROW One row is ignored
22 MESSAGE_DB_EXCEPTION
23 FILE_FORMAT_CSV csv
24 FILE_FORMAT_TSV tsv
25 FILE_FORMAT_CSVZ csvz
26 FILE_FORMAT_TSVZ tsvz
27 FILE_FORMAT_ODS ods
28 FILE_FORMAT_XLS xls
29 FILE_FORMAT_XLSX xlsx
30 FILE_FORMAT_XLSM xlsm
31 FILE_FORMAT_XLSB xlsb
32 FILE_FORMAT_HTML html
33 FILE_FORMAT_PDF pdf
34 DB_SQL sql
35 DB_DJANGO django
36 DB_QUERYSET queryset
37 KEYWORD_TSV_DIALECT excel-tab
38 KEYWORD_LINE_TERMINATOR lineterminator
39 DEFAULT_MULTI_CSV_SEPARATOR __
40 SEPARATOR_FORMATTER —pyexcel—%s
41 SEPARATOR_MATCHER —pyexcel:(.*)—
42 DEFAULT_CSV_STREAM_FILE_FORMATTER —pyexcel:%s—%s
43 DEFAULT_CSV_NEWLINE
【pyexcel.internal.sheets.formatters】
formatters, fullname=pyexcel.internal.sheets.formatters, file=pyexcel\internal\sheets\formatters.py
【pyexcel.internal.sheets._shared】
_shared, fullname=pyexcel.internal.sheets._shared, file=pyexcel\internal\sheets_shared.py
【pyexcel.internal.sheets.row】
row, fullname=pyexcel.internal.sheets.row, file=pyexcel\internal\sheets\row.py
【pyexcel.internal.sheets.column】
column, fullname=pyexcel.internal.sheets.column, file=pyexcel\internal\sheets\column.py
【pyexcel.internal.sheets.extended_list】
extended_list, fullname=pyexcel.internal.sheets.extended_list, file=pyexcel\internal\sheets\extended_list.py
【pyexcel.internal.sheets.matrix】
matrix, fullname=pyexcel.internal.sheets.matrix, file=pyexcel\internal\sheets\matrix.py
【json】
json, fullname=json, file=json_init_.py
【datetime】
datetime, fullname=datetime, file=datetime.py