2018-12-11

2018-12-11  本文已影响0人  Sumulan

Python学习第一天

BIF

Built in Functions   内置函数(只需要直接调用即可)

>>> dir (__builtins__)  //显示内置函数有哪些

 ['ArithmeticError', 'AssertionError', 'AttributeError', 'BaseException', 'BlockingIOError', 'BrokenPipeError', 'BufferError', 'BytesWarning', 'ChildProcessError', 'ConnectionAbortedError', 'ConnectionError', 'ConnectionRefusedError', 'ConnectionResetError', 'DeprecationWarning', 'EOFError', 'Ellipsis', 'EnvironmentError', 'Exception', 'False', 'FileExistsError', 'FileNotFoundError', 'FloatingPointError', 'FutureWarning', 'GeneratorExit', 'IOError', 'ImportError', 'ImportWarning', 'IndentationError', 'IndexError', 'InterruptedError', 'IsADirectoryError', 'KeyError', 'KeyboardInterrupt', 'LookupError', 'MemoryError', 'NameError', 'None', 'NotADirectoryError', 'NotImplemented', 'NotImplementedError', 'OSError', 'OverflowError', 'PendingDeprecationWarning', 'PermissionError', 'ProcessLookupError', 'RecursionError', 'ReferenceError', 'ResourceWarning', 'RuntimeError', 'RuntimeWarning', 'StopAsyncIteration', 'StopIteration', 'SyntaxError', 'SyntaxWarning', 'SystemError', 'SystemExit', 'TabError', 'TimeoutError', 'True', 'TypeError', 'UnboundLocalError', 'UnicodeDecodeError', 'UnicodeEncodeError', 'UnicodeError', 'UnicodeTranslateError', 'UnicodeWarning', 'UserWarning', 'ValueError', 'Warning', 'WindowsError', 'ZeroDivisionError', '_', '__build_class__', '__debug__', '__doc__', '__import__', '__loader__', '__name__', '__package__', '__spec__', 'abs', 'all', 'any', 'ascii', 'bin', 'bool', 'bytearray', 'bytes', 'callable', 'chr', 'classmethod', 'compile', 'complex', 'copyright', 'credits', 'delattr', 'dict', 'dir', 'divmod', 'enumerate', 'eval', 'exec', 'exit', 'filter', 'float', 'format', 'frozenset', 'getattr', 'globals', 'hasattr', 'hash', 'help', 'hex', 'id', 'input', 'int', 'isinstance', 'issubclass', 'iter', 'len', 'license', 'list', 'locals', 'map', 'max', 'memoryview', 'min', 'next', 'object', 'oct', 'open', 'ord', 'pow', 'print', 'property', 'quit', 'range', 'repr', 'reversed', 'round', 'set', 'setattr', 'slice', 'sorted', 'staticmethod', 'str', 'sum', 'super', 'tuple', 'type', 'vars', 'zip']  

>>> help (input)

Help on built-in function input in module builtins:

input(prompt=None, /)

    Read a string from standard input.  The trailing newline is stripped.

    The prompt string, if given, is printed to standard output without a

    trailing newline before reading input.

    If the user hits EOF (*nix: Ctrl-D, Windows: Ctrl-Z+Return), raise EOFError.

    On *nix systems, readline is used if available.

>>>


>>> te = '小甲鱼'

>>> print (te)

小甲鱼

>>> f = 3

>>> s = 8

>>> t = f+s

>>> print (t)

11

>>> 'Let\' Go!'

"Let' Go!"

>>> str = 'c:\now'

>>> str

'c:\now'

>>> print (str)

c:

ow

>>> str = 'c:\\now'

>>> print (str)

c:\now

>>> str = r'c:\now'

>>> print (str)

c:\now

>>> str = r'c:\now\file\kaka'

>>> print (str)

c:\now\file\kaka

>>> str = """我爱鱼C,

正如我爱小甲鱼。

他那呱唧呱唧

呱唧呱唧

呱唧呱唧的声音

总缠绕在我的脑海

久久不肯散去,,........

"""

>>> str

'我爱鱼C,\n正如我爱小甲鱼。\n他那呱唧呱唧\n呱唧呱唧\n呱唧呱唧的声音\n总缠绕在我的脑海\n久久不肯散去,,........\n'

>>> print (str)

我爱鱼C,

正如我爱小甲鱼。

他那呱唧呱唧

呱唧呱唧

呱唧呱唧的声音

总缠绕在我的脑海

久久不肯散去,,........

上一篇下一篇

猜你喜欢

热点阅读