Does string start with? Does string end with?
All posts by
Using Strings-Searching Strings
Does String Contain String in Does string start with Case insitive Does string end with
Using Strings-Replace and Insert
Replace Add string to string, forcing a fixed length
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-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-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 […]
Naming conventions in Python
Whilst you can do what you want, the creators of Python specify naming conventions that should be followed: ClassNamesInStudlyCaps CONSTANTS_IN_ALL_CAPS variable_names_in_snake_case method_names_in_snake_case function_names_in_snake_case
.Functions general
Using Parameters Default values Return values Multiple return values Using a dictionary for multiple return values
List comprehension
Combines a for loop into the creation of a new list based on an existing list. Adding conditional arguments if You simply add an if statement to the end: if else Examples Create list with 100 entries of 0 Create list with 100 random entries
Keystrokes
Terminate a program e.g. due to an infinite loop CTRL+C