Home > other >  How do you use a FOR loop in a list to add items from a JSON file? Discord.py
How do you use a FOR loop in a list to add items from a JSON file? Discord.py

Time:04-21

Let me explain...

Take a look at this JSON file:

{
    "Gaming":"Become an Epic Gamer Dude!",
    "Reaction":"React to Trending Topics!",
    "Vlogging":"Share Events of Your Life!",
    "Technology":"Show us Some Geek Stuff!",
    "Business":"How to make money online?",
    "Music":"Craft For us Some Beats!",
    "Fashion":"Looking Good in That Outfit!"
}

These are some social media niches that I have in a JSON file a sentence about each. I am not having any issues with this, instead, take a look at this select menu (Py-Cord or discord.py):

with open('niches.json', 'r') as f:
    niches = json.load(f)

niche_menu = Select(placeholder="What Type of Influencer are you?", options=[
    for niche in niches:
        discord.SelectOption(label=(niche).upper(), emoji="           
  • Related