Tuesday, June 17, 2014

Open browser in Python, with webbrowser



import webbrowser

webbrowser.open("https://docs.python.org/3/library/webbrowser.html")

dictionary vs tuple

One of the main differency between dictionary and tuple is 'tuple' indices must be integers and 'tuple' object does not support item assignment.


dictionary = {"day0": "sday", "day1": "Monday"}
print(dictionary["day0"])
dictionary["day0"] = "Sunday"
print(dictionary["day0"])

#tuple indices must be integers
tuple = ("sday", "Monday")
print(tuple[0])
#'tuple' object does not support item assignment
#tuple[0] = "Sunday"