In this video we'll begin by discussing the basics of the Python string, later, we'll open up a coding editor and showcase some of the more important functions built into the object.
MISTAKE! As pointed out by Akshat Barbhaya, strings in Python are immutable and don't support setting individual characters. Alternatively you can get around this (although I don't recommend it) by converting the string to a list, changing the character, then joining the list back into a string.
If you're interested in Python GUI development check out my video series starting with: • Python GUI Development...
Further reading material: docs.python.org/2/library/str...
The string module contains a number of useful constants and classes, as well as some deprecated legacy functions that are also available as methods on strings. In addition, Python’s built-in string classes support the sequence type methods described in the Sequence Types - str, unicode, list, tuple, bytearray, buffer, xrange section, and also the string-specific methods described in the String Methods section. To output formatted strings use template strings or the % operator described in the String Formatting Operations section. Also, see the re module for string functions based on regular expressions.
3 сен 2017