Struggling with parsing a list. /u/tuxon64 Python Education
Struggling with parsing a list. /u/tuxon64 Python Education
I’m accessing a smart energy monitoring plug for monthly usage. The output I get is a single element list like this.
json_str is [‘”== Emeter ==\n== For year 2024 ==\nMonth, usage (kWh)\n11, 11.72\n12, 21.292\n”‘]
I just need to extract the number after nXX, where XX will be 01 through 12 for the different months. In this case I need the 11.72 and the 21.292, so I can add them and get my total usage.
submitted by /u/tuxon64
[link] [comments]
r/learnpython I’m accessing a smart energy monitoring plug for monthly usage. The output I get is a single element list like this. json_str is [‘”== Emeter ==\n== For year 2024 ==\nMonth, usage (kWh)\n11, 11.72\n12, 21.292\n”‘] I just need to extract the number after nXX, where XX will be 01 through 12 for the different months. In this case I need the 11.72 and the 21.292, so I can add them and get my total usage. submitted by /u/tuxon64 [link] [comments]
I’m accessing a smart energy monitoring plug for monthly usage. The output I get is a single element list like this.
json_str is [‘”== Emeter ==\n== For year 2024 ==\nMonth, usage (kWh)\n11, 11.72\n12, 21.292\n”‘]
I just need to extract the number after nXX, where XX will be 01 through 12 for the different months. In this case I need the 11.72 and the 21.292, so I can add them and get my total usage.
submitted by /u/tuxon64
[link] [comments] I’m accessing a smart energy monitoring plug for monthly usage. The output I get is a single element list like this. json_str is [‘”== Emeter ==\n== For year 2024 ==\nMonth, usage (kWh)\n11, 11.72\n12, 21.292\n”‘] I just need to extract the number after nXX, where XX will be 01 through 12 for the different months. In this case I need the 11.72 and the 21.292, so I can add them and get my total usage. submitted by /u/tuxon64 [link] [comments]