Strings can use single or double quotes Join strings Multiline strings using triple quotes Use triple single quotes or double quotes to start and end a multiline string. Line breaks will occur for the linebreaks in the string you enter. Joining strings Use the period character ‘+’ You can also use += Length
Category: Strings
Comma Separated Strings
Convert Comma Separated String To List Note, when you split a string on a character that it also ends with, you’ll end up with an empty string at the end of the list. Convert List into comma separated string
Sanitising & encoding strings
URL Encode and Decode
Special characters in strings
Using Strings-Characters
String Characters A string is a list of characters Negative indices Negative indices count backward from the end of the string, so string_name[-1] is the last character of the string, etc Altering characters in a string Strings are immutable in Python, so you can’t do this: you have to do this instead: Work through each […]
Using Strings-Extracting
Substring Convert string to value Get string from character position # (Remove text from beginning or end of string) Getting beginning of a string Getting end of string
Using Strings-Formatting
Trim leading and trailing whitespace Capitalise 1st letter of first word String to lowercase String to uppercase
Using Strings-Parsing
Convert Comma Separated String To List Note, when you split a string on a character that it also ends with, you’ll end up with an empty string at the end of the list.
Using Strings-Replace and Insert
Replace
Using Strings-Searching Strings
Does String Contain String in Does string start with Case insitive Does string end with