Sometimes you get strings instead of objects and you have to parse them out. Here's an example where the raw data I got from a Twitch chatbot message wasn't useful to me until I parsed it into a dictionary.
Chris Biscardi: [00:01] Let's start by opening a Python ripple. Next we'll assign the variable raw data to our string. I happen to get this string from a Twitch bot. Note that there are key value pairs, nothing is quoted and all the key value pairs were separated by a semicolon. First, we'll want to split the string on the semicolon.
[00:25] Next, for each item in the resulting list, we want to split on the equal sign. Finally, we want to construct a dictionary. We'll also set the result to items. Note that items is now a dictionary. Because items is a dictionary, we can now get any key in that dictionary. Here it seems that the subscriber value is a one wrapped in a string. We would want to deal with that if we cared about this value.
[01:07] Here's the username that sent the message.
Member comments are a way for members to communicate, interact, and ask questions about a lesson.
The instructor or someone from the community might respond to your question Here are a few basic guidelines to commenting on egghead.io
Be on-Topic
Comments are for discussing a lesson. If you're having a general issue with the website functionality, please contact us at support@egghead.io.
Avoid meta-discussion
Code Problems?
Should be accompanied by code! Codesandbox or Stackblitz provide a way to share code and discuss it in context
Details and Context
Vague question? Vague answer. Any details and context you can provide will lure more interesting answers!