Last active
September 24, 2015 05:17
-
-
Save AaronPhalen/8de5f330c5004732ccbd to your computer and use it in GitHub Desktop.
Python Collections Basic Examples
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Author: Aaron Phalen | Twitter: @aaron_phalen | Email: [email protected] | |
# Useful modules and examples from python's collections library | |
from collections import namedtuple | |
# 1. Python collections namedtuple | |
Parameters = namedtuple("Parameters", "x y z") | |
parameters = Parameters(x="1", y="2", z="3") | |
# Output | |
print parameters | |
# Parameters(x=1, y=2, z=3) | |
print parameters.x, parameters.y, parameters.z | |
# 1, 2, 3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment