Skip to content
murmot

Results for “python split example code error site:docs.python.org pdf”

  • docs.python.org

    shlex — Simple lexical analysis — Python 3.15.2 documentation

    This will often be useful for writing minilanguages, (for example, in run control files for Python applications) or for parsing quoted strings. The shlex module defines the following functions: shlex.split(s, comments=False, posix=True)¶. Split the string s using shell-like syntax.

  • docs.python.org

    string — Common string operations — Python 3.10.21 documentation

    Mar 10, 2021 · A primary use case for template strings is for internationalization (i18n) since in that context, the simpler syntax and functionality makes it easier to translate than other built-in string formatting facilities in Python. As an example of a library built on template strings for i18n, see the flufl.i18n package.

  • docs.python.org

    Built-in Exceptions — Python 3.12.16 documentation

    In Python, all exceptions must be instances of a class that derives from BaseException.The built-in exceptions listed in this chapter can be generated by the interpreter or built-in functions. Except where mentioned, they have an “associated value” indicating the detailed cause of the error.

  • docs.python.org

    Python 3.15.2 documentation

    1 day ago · What's new in Python 3.15? Or all "What's new" documents since Python 2.0 Tutorial Start here: a tour of Python's syntax and features Built-ins reference Built-in functions and classes Library reference Standard library modules Language reference Syntax and language elements Python setup and usage How to install, configure, and use Python Python HOWTOs In-depth topic manuals Installing Python ...

  • docs.python.org

    Index — Python 3.15.2 documentation

    Symbols · comment, [1], [2] · in doctests · in printf-style formatting, [1] · in regular expressions · in string formatting · source encoding declaration.

  • docs.python.org

    4. More Control Flow Tools — Python 3.15.2 documentation

    This example, as usual, demonstrates some new Python features: The return statement returns with a value from a function. return without an expression argument returns None. Falling off the end of a function also returns None.

  • docs.python.org

    os.path — Common pathname manipulations — Python 3.15.2 ...

    1 day ago · os.path.basename(path, /) ¶ Return the base name of pathname path. This is the second element of the pair returned by passing path to the function split (). Note that the result of this function is different from the Unix basename program; where basename for '/foo/bar/' returns 'bar', the basename () function returns an empty string ('').

  • docs.python.org

    Built-in Types — Python 3.11.18 documentation

    To clarify the above rules, here’s some example Python code, equivalent to the built-in hash, for computing the hash of a rational number, float, or complex: import sys, math.

  • docs.python.org

    2. Lexical analysis — Python 3.15.2 documentation

    2 days ago · 2. Lexical analysis ¶ A Python program is read by a parser. Input to the parser is a stream of tokens, generated by the lexical analyzer (also known as the tokenizer). This chapter describes how the lexical analyzer produces these tokens. The lexical analyzer determines the program text’s encoding (UTF-8 by default), and decodes the text into source characters. If the text cannot be decoded ...