Pelokalan
Python ID
id en
Masuk
Proyek
builtins__stdtypes.po Berkas proyek · python-docs-id-3.14 · Bahasa Indonesia
Modul PO Hanya lihat
Teks sumber — English
Terjemahan — Bahasa Indonesia
This is a short-circuit operator, so it only evaluates the second argument if the first one is false.
Ini adalah operator hubungan singkat, sehingga hanya mengevaluasi argumen kedua jika yang pertama salah.
This is a short-circuit operator, so it only evaluates the second argument if the first one is true.
Ini adalah operator hubungan singkat, sehingga hanya mengevaluasi argumen kedua jika yang pertama benar.
Return an :term:`iterator` object. The object is required to support the iterator protocol described below. If a container supports different types of iteration, additional methods can be provided to specifically request iterators for those iteration types. (An example of an object supporting multiple forms of iteration would be a tree structure which supports both breadth-first and depth-first traversal.) This method corresponds to the :c:member:`~PyTypeObject.tp_iter` slot of the type structure for Python objects in the Python/C API.
Return the index of the first occurrence of *value* in *sequence*.
Remove the first item from *sequence* where ``sequence[i] == value``.
Passing a :class:`bytes` object to :func:`str` without the *encoding* or *errors* arguments falls under the first case of returning the informal string representation (see also the :option:`-b` command-line option to Python). For example::
Return a copy of the string with its first character capitalized and the rest lowercased. For example:
The first character is now put into titlecase rather than uppercase. This means that characters like digraphs will only have their first letter capitalized, instead of the full character.
Split the string at the first occurrence of *sep*, and return a 3-tuple containing the part before the separator, the separator itself, and the part after the separator. If the separator is not found, return a 3-tuple containing the string itself, followed by two empty strings.
Return a copy of the string with all occurrences of substring *old* replaced by *new*. If *count* is given, only the first *count* occurrences are replaced. If *count* is not specified or ``-1``, then all occurrences are replaced. For example:
The alternate form causes a leading octal specifier (``'0o'``) to be inserted before the first digit.
The alternate form causes a leading ``'0x'`` or ``'0X'`` (depending on whether the ``'x'`` or ``'X'`` format was used) to be inserted before the first digit.
Firstly, the syntax for bytes literals is largely the same as that for string literals, except that a ``b`` prefix is added:
Remove the first *n* bytes from the bytearray and return them as an immutable :class:`bytes`. By default (if *n* is ``None``), return all bytes and clear the bytearray.
If *n* is negative, index from the end and take the first :func:`len` plus *n* bytes. If *n* is out of bounds, raise :exc:`IndexError`.
Split the sequence at the first occurrence of *sep*, and return a 3-tuple containing the part before the separator, the separator itself or its bytearray copy, and the part after the separator. If the separator is not found, return a 3-tuple containing a copy of the original sequence, followed by two empty bytes or bytearray objects.
Return a copy of the sequence with all occurrences of subsequence *old* replaced by *new*. If *count* is given, only the first *count* occurrences are replaced. If *count* is not specified or ``-1``, then all occurrences are replaced.
Return a copy of the sequence with each byte interpreted as an ASCII character, and the first byte capitalized and the rest lowercased. Non-ASCII byte values are passed through unchanged.
*order* can be {'C', 'F', 'A'}. When *order* is 'C' or 'F', the data of the original array is converted to C or Fortran order. For contiguous views, 'A' returns an exact copy of the physical memory. In particular, in-memory Fortran order is preserved. For non-contiguous views, the data is converted to C first. *order=None* is the same as *order='C'*.
Return the index of the first occurrence of *value* (at or after index *start* and before index *stop*).
Both :class:`set` and :class:`frozenset` support set to set comparisons. Two sets are equal if and only if every element of each set is contained in the other (each is a subset of the other). A set is less than another set if and only if the first set is a proper subset of the second set (is a subset, but is not equal). A set is greater than another set if and only if the first set is a proper superset of the second set (is a superset, but is not equal).
Binary operations that mix :class:`set` instances with :class:`frozenset` return the type of the first operand. For example: ``frozenset('ab') | set('bc')`` returns an instance of :class:`frozenset`.
If no positional argument is given, an empty dictionary is created. If a positional argument is given and it defines a ``keys()`` method, a dictionary is created by calling :meth:`~object.__getitem__` on the argument with each returned key from the method. Otherwise, the positional argument must be an :term:`iterable` object. Each item in the iterable must itself be an iterable with exactly two elements. The first element of each item becomes a key in the new dictionary, and the second element the corresponding value. If a key occurs more than once, the last value for that key becomes the corresponding value in the new dictionary.
Providing keyword arguments as in the first example only works for keys that are valid Python identifiers. Otherwise, any valid keys can be used.
Remove and return a ``(key, value)`` pair from the dictionary. Pairs are returned in :abbr:`LIFO (last-in, first-out)` order.