Pelokalan
Python ID
id en
Masuk
Proyek
library__collections.po Berkas proyek · python-docs-id-3.14 · Bahasa Indonesia
Modul PO Hanya lihat
Teks sumber — English
Terjemahan — Bahasa Indonesia
:class:`UserString`
:class:`UserString`
:class:`UserString` objects
objek :class:`UserString`
The class, :class:`UserString` acts as a wrapper around string objects. The need for this class has been partially supplanted by the ability to subclass directly from :class:`str`; however, this class can be easier to work with because the underlying string is accessible as an attribute.
Class that simulates a string object. The instance's content is kept in a regular string object, which is accessible via the :attr:`data` attribute of :class:`UserString` instances. The instance's contents are initially set to a copy of *seq*. The *seq* argument can be any object which can be converted into a string using the built-in :func:`str` function.
In addition to supporting the methods and operations of strings, :class:`UserString` instances provide the following attribute:
A real :class:`str` object used to store the contents of the :class:`UserString` class.