Skip to content

Tag: python

Getting ID instead of Name in list

I am doing CRUD project with foreign keys and I am using serializers.I want to get the Name of the categories,sub categories,color and size instead of thier IDs serializer: models are: below is the insert function show function instead of name of categories subcategories color size etc I am getting id below i…

Selenium 4.3.0 get the element of button type to python

I am struggling on how to get the button type element in this example, so that I can be able to test it using selenium in python. My Code: I think the code changed because of the selenium version? I need help guys Thank you. Answer There is no such selector type as “type”. You can either use anoth…

discord.py self-bot replies only to itself

I’m new at programming. I want to write a bot for my Discord channel to send users “hi” messages who send “hello”. But there is a problem, only I (the self bot) can receive the “hi!” message. When I write “hello” from another account, the bot doesn’t…

Create list of empty lists having name

I am pretty new to python and looking for how to create a list of empty lists having names more efficiently than presented below I would like to have some names to the lists. Answer Beacuse you want it to have name, how about using dict?

Pandas data frame index

if I have a Series But, I need a standard index = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], with index[4, 7, 8] values equal to zeros. So I expect the updated series will be How should I update the series? Thank you in advance! Answer Try this: Output: