ldrl

Python cheatsheet

Strings

Strings methods

Convert elements of a list to a string with a specified separator

Integers

Action Syntaxe
Display The Zen of Python, by Tim Peters import this
Comments #
Print string print(string)
Ask for user input input(string)
Remove whitespace from strings strip(), rstrip(), lstrip()
Convert integer to string str(integer)
Chaining functions input("What's your name? ").strip().title()
Declare list fruits = [’banana’, ‘apple’, ‘orange’]
Divide strings into list first, last = name.split()
Join list items into a string separator.join(iterable)
Add a tab \t
Add a a new line \n