Skip to main content

Command Palette

Search for a command to run...

Day 95: Data Types in Python

Understanding Lists, Tuples, and Dictionaries in Python for DevOps

Published
โ€ข1 min read
Day 95: Data Types in Python

Today, I explored Pythonโ€™s core data structures โ€” lists, tuples, and dictionaries โ€” which are essential when managing infrastructure data, configurations, and automation logic in DevOps scripts.


๐Ÿ“‹ Lists

Lists are ordered and mutable collections โ€” perfect for storing groups of items like server names or container IDs.

servers = ["web01", "web02", "db01"]
servers.append("cache01")
print(servers)

โœ… Use case: Iterating over multiple resources to deploy or configure them.


๐Ÿ“ฆ Tuples

Tuples are ordered but immutable collections โ€” ideal when you want fixed sets of data that shouldnโ€™t change.

region = ("us-east-1", "t2.micro")
print(region[0])

โœ… Use case: Storing static configurations like region + instance type pairs.


๐Ÿ“‚ Dictionaries

Dictionaries store key-value pairs โ€” useful for mapping resource names to their attributes.

config = {
    "web01": "10.0.0.1",
    "db01": "10.0.0.2"
}
print(config["web01"])

โœ… Use case: Handling inventory data, credentials, or service metadata in scripts.


๐Ÿ’ก Key Takeaways

โœ… Lists โ†’ Flexible and editable collections
โœ… Tuples โ†’ Safe, read-only collections
โœ… Dictionaries โ†’ Key-value mappings for structured data


๐Ÿ’ป These data types form the foundation of every Python automation script. Mastering them makes managing infrastructure data clean, efficient, and scalable.

DevOps overview as a beginner

Part 1 of 50

Sharing my journey of learning DevOps as a beginner โ€” covering essential tools, cloud setup, CI/CD, Docker, monitoring, and more, step by step with practical examples.