About 21,000,000 results
Open links in new tab
  1. How to Implement Python __str__ Magic Method - Python Tutorial

    To customize the string representation of a class instance, the class needs to implement the __str__ magic method. Internally, Python will call the __str__ method automatically when an …

  2. Can '\' be in a Python string? - Stack Overflow

    Mar 20, 2014 · as a single backslash has special meaning in a Python string as the start of an escape sequence. A double \\ results in the string containing a single backslash: If the …

  3. Python str() function - GeeksforGeeks

    May 1, 2025 · The str() function in Python is an in-built function that takes an object as input and returns its string representation. It can be used to convert various data types into strings, …

  4. Python str() Function - W3Schools

    The str() function converts the specified value into a string. str (object, encoding= encoding, errors= errors) Any object. Specifies the object to convert into a string. The encoding of the …

  5. Python str() (With Examples) - Programiz

    The str() function returns the string version of the given object. In this tutorial, we will learn about Python str() in detail with the help of examples.

  6. string — Common string operations — Python 3.13.3 …

    3 days ago · The default version understands ‘s’ (str), ‘r’ (repr) and ‘a’ (ascii) conversion types. Format String Syntax¶ The str.format() method and the Formatter class share the same syntax …

  7. Create a string in Python (single/double/triple quotes, str())

    May 9, 2023 · In Python, strings (str) can be created by enclosing text in single quotes ', double quotes ", and triple quotes (''', """). You can also convert objects of other types into strings …

  8. Strings and Character Data in Python – Real Python

    Dec 22, 2024 · Python strings are a sequence of characters used for handling textual data. You can create strings in Python using quotation marks or the str() function, which converts objects …

  9. String Manipulation in Python - PythonForBeginners.com

    Jun 10, 2023 · To manipulate strings, we can use some of Pythons built-in methods. To create a string with given characters, you can assign the characters to a variable after enclosing them …

  10. str() in Python - Built-In Functions with Examples - Dive Into Python

    The str() function in Python is a built-in function that converts the specified value into a string. It returns a string version of the object, which can be a number, a list, a tuple, or any other …

Refresh