Skip to content

Instantly share code, notes, and snippets.

@studiawan
Last active March 11, 2021 04:55
Show Gist options
  • Save studiawan/6546416 to your computer and use it in GitHub Desktop.
Save studiawan/6546416 to your computer and use it in GitHub Desktop.
Python tuple declaration, initialization, and how to access
# declaration without brackets
# elements are separated with comma
address = 'localhost', 80, 21
# declaration with brackets
server_address = ('localhost', 5000)
# access by index
print(server_address[0])
# access by iteration
for value in server_address:
print(value)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment