Starting a simple HTTP web server
A simple HTTP Server can be started in seconds.
Once started you can open http://127.0.0.1:8000/. The browser will show you the contents of the directory.
A funny text
Try the statement below to display a poem by Tim Peters.
XKCD web comic
You can open a comic on XKCD using:
Using Zip to combine arrays
You can zip the two arrays with:
b = [[1, 2, 3, 4], [6, 5, 4, 3]]
Reverse a list
To reverse a list, you could implement a function. But why go through the trouble if it’s already implemented?
b = [1,2,3,4,5]
Reverse a string
Instead of creating a method to reverse a string you can use:
s = "Hello world"
You do not need to define a temporary variable to swap to variables in Python:
a = 1
If you know of any tips or tricks, leave a comment. :-)