Created
May 12, 2020 22:37
-
-
Save BrandonClapp/edb81aa071888e290d50f81ebad0a44b to your computer and use it in GitHub Desktop.
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
# Dictionary to store stream responses in | |
responses = { | |
"123": [], | |
"456": [], | |
} | |
# Dummy stream | |
port_123_stream = ["I am a line", "I like cake", "Turtles too"] | |
port_456_stream = ["Some other line", "Pizza party", "Puppy power"] | |
# Dummy subscription to the port's stream | |
for line in port_123_stream: | |
port = "123" | |
responses[port].append(line) | |
# Dummy subscription to another port's stream. | |
for line in port_456_stream: | |
port = "456" | |
responses[port].append(line) | |
# Should output something like | |
# {'123': ['I am a line', 'I like cake', 'Turtles too'], '456': ['Some other line', 'Pizza party', 'Puppy power']} | |
print(responses) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment