Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Combining arrays into dict
#5
I'm sorry. I don't understand what was edited in the question. The dictionary looks the same to me and the same as the program I gave above creates:

Output:
{'in_ledS': 0, 'in_ledXL': 1, 'in_ledXXL': 0, 'in_ledS1': 1, 'in_ledS2': 1}
If you need the strings, don't store them as separate variables. You haven't shown how they're used, so right now there's no reason to have the variables.

Store the strings in a list or a dict and associate the data you need with them.
Reply


Messages In This Thread
Combining arrays into dict - by ebolisa - Sep-26-2021, 09:06 PM
RE: Combining arrays into dict - by bowlofred - Sep-26-2021, 09:20 PM
RE: Combining arrays into dict - by ebolisa - Sep-26-2021, 09:27 PM
RE: Combining arrays into dict - by Pedroski55 - Sep-26-2021, 11:44 PM
RE: Combining arrays into dict - by bowlofred - Sep-26-2021, 11:56 PM
RE: Combining arrays into dict - by deanhystad - Sep-27-2021, 02:52 AM
RE: Combining arrays into dict - by ebolisa - Sep-27-2021, 07:52 AM
RE: Combining arrays into dict - by deanhystad - Sep-27-2021, 03:15 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020