- A sequence is an ordered list of items, such as stock prices or exam scores.
- Python strings are sequences of characters, where each character is also a string.
- You can access individual characters in a string using indexing, e.g., "help"[0] returns 'h'.
- Strings can be processed as whole entities or by accessing specific characters.
- Operators like + can concatenate strings, e.g., "Hello" + " World" gives "Hello World".
- Methods like .upper() can be called on string objects to transform them, e.g., "hello".upper() returns "HELLO".
- String literals are explicit string values in the source code, useful for initial assignments.
- The join method can concatenate strings with a separator, e.g., ".".join(["192", "168"]) returns "192.168".
- The split method divides a string into a list based on a delimiter, e.g., "192.168.1.1".split(".") gives ['192', '168', '1', '1'].
- Escape sequences like \n for new lines and \t for tabs add special characters to strings.
- In Python, strings are objects, and their methods can be used for various operations.
- Strings are immutable, meaning their content cannot be changed once created.
- To modify a string, you create a new string, not alter the original.
- Indexing retrieves single characters from a string, e.g., "Monty"[0] gives 'M'.
- Slicing retrieves substrings, e.g., "Monty"[0:3] gives 'Mon'.
- Regular expressions specify patterns for matching strings using special characters.
- The match method checks if a pattern matches a string, returning a Match object.
- Formatting strings using the format() method inserts variables into strings at specified positions.
- String methods like .upper() return new strings without modifying the original.
- Encoding converts characters to their numeric Unicode representations, and decoding reverses this.