VB.net 2010 视频教程 VB.net 2010 视频教程 python基础视频教程
SQL Server 2008 视频教程 c#入门经典教程 Visual Basic从门到精通视频教程
当前位置:
首页 > 编程开发 > python爬虫 >
  • python爬虫之Python中的内置函数(2)

本站最新发布   Python从入门到精通|Python基础教程
试听地址  
https://www.xin3721.com/eschool/pythonxin3721/


| The bytes objects frm and to must be of the same length.

|

| ----------------------------------------------------------------------

| Data and other attributes defined here:

|

| __hash__ = None

********************************************************************************************

filter()

>>> for i in filter(is_odd, [1, 3, 3, 4]):

... print(i)

...

1

3

3

********************************************************************************************

issubclass()

********************************************************************************************

pow()

********************************************************************************************

super()

Help on class super in module builtins:

class super(object)

| super() -> same as super(__class__, <first argument>)

| super(type) -> unbound super object

| super(type, obj) -> bound super object; requires isinstance(obj, type)

| super(type, type2) -> bound super object; requires issubclass(type2, type)

| Typical use to call a cooperative superclass method:

就是在类的定义时,子类重写父类属性还要继承父类的属性时使用:

| class C(B):

| def meth(self, arg):

| super().meth(arg)

| This works for class methods too:

| class C(B):

| @classmethod

| def cmeth(cls, arg):

| super().cmeth(arg)

|

| Methods defined here:

|

| __get__(self, instance, owner, /)

| Return an attribute of instance, which is of type owner.

|

| __getattribute__(self, name, /)

********************************************************************************************

bytes()

class bytes(object)

| bytes(iterable_of_ints) -> bytes

| bytes(string, encoding[, errors]) -> bytes

| bytes(bytes_or_buffer) -> immutable copy of bytes_or_buffer

| bytes(int) -> bytes object of size given by the parameter initialized with null bytes

| bytes() -> empty bytes object

|

| Construct an immutable array of bytes from:

| - an iterable yielding integers in range(256)

| - a text string encoded using the specified encoding

| - any object implementing the buffer API.

| - an integer

|

| Methods defined here:

|

| __add__(self, value, /)

| Return self+value.

|

| __contains__(self, key, /)

| Return key in self.

********************************************************************************************

float()

********************************************************************************************

iter()

********************************************************************************************

print()

********************************************************************************************

tuple()

********************************************************************************************

callable()

********************************************************************************************

format()

********************************************************************************************

len()

********************************************************************************************

property()

********************************************************************************************

type()

********************************************************************************************

chr()

********************************************************************************************

frozenset()

frozenset() 返回一个冻结的集合,冻结后集合不能再添加或删除任何元素

********************************************************************************************

list()

********************************************************************************************

range()

********************************************************************************************

vars()

{'__name__': '__main__', '__doc__': None, '__package__': None, '__loader__': <class '_frozen_importlib.BuiltinImporter'>, '__spec__': None, '__annotations__': {}, '__builtins__': <module 'builtins' (built-in)>, 'str': <code object <module> at 0x1098a5420, file "a", line 1>}

********************************************************************************************

classmethod()

********************************************************************************************

getattr()

********************************************************************************************

locals()

********************************************************************************************

repr()

>>> repr('a') 
"'a'"

********************************************************************************************

zip()

********************************************************************************************

compile()

compile(source, filename, mode, flags=0, dont_inherit=False, optimize=-1)

Compile source into a code object that can be executed by exec() or eval().

  1. The source code may represent a Python module, statement or expression.
  2. The filename will be used for run-time error messages.

The mode must be 'exec' to compile a module,

'single' to compile a single (interactive) statement,

'eval' to compile an expression.

>>> str = compile("print('hello world')",'a',mode = 'eval')
>>> eval(str)
hello world

 

The flags argument, if present, controls which future statements influence

the compilation of the code.

The dont_inherit argument, if true, stops the compilation inheriting

the effects of any future statements in effect in the code calling

compile; if absent or false these statements do influence the compilation,

in addition to any features explicitly specified.

 

********************************************************************************************

globals()

globals()

Return the dictionary containing the current scope's global variables.

NOTE: Updates to this dictionary *will* affect name lookups in the current

global scope and vice-versa.

 

********************************************************************************************

map()

>>> for i in map(abs, [-1, 2, 3]):

... print(i)

...

1

2

3

********************************************************************************************

reversed()

>>> for i in reversed([2, 3, 4, 5]):  
...     print(i, end = '
')  
... 
5
4
3
2

>>> help(reversed)

 

|

| Methods defined here:

|

| __getattribute__(self, name, /)

| Return getattr(self, name).

|

| __iter__(self, /)

| Implement iter(self).

|

| __length_hint__(...)

| Private method returning an estimate of len(list(it)).

|

| __new__(*args, **kwargs) from builtins.type

| Create and return a new object. See help(type) for accurate signature.

|

| __next__(self, /)

| Implement next(self).

|

| __reduce__(...)

| Return state information for pickling.

|

| __setstate__(...)

| Set state information for unpickling.

********************************************************************************************

__import__()

********************************************************************************************

complex()

********************************************************************************************

hasattr()

********************************************************************************************

max()

********************************************************************************************

round()

********************************************************************************************

delattr()

********************************************************************************************

hash()

********************************************************************************************

memoryview()

>>> v = memoryview(b'abcefg')

>>> v[1]

98

>>> v[-1]

103

>>> v[1:4]

<memory at 0x1095f6ac8>

>>> bytes(v[1:4])

b'bce'

********************************************************************************************

set()

相关教程