Get elements from list in python by ¿index?

ElmerKao

I want to get the ids from this list to put them in an other to use

random.choice(list)

[<Member id=986970159736586261 name='Nasgar-Bot' discriminator='5799' bot=True nick=None guild=>, <Member id=568157479020527636 name='ElmerKao' discriminator='0058' bot=False nick=None guild=>]

How can i get the id from here and put them into a list to use that command?

Tirterra

The way you worded you problem wasn't very clear but I think I understood, you want to add a user id in a list.Let's imagine the user sent a message. that you passed to your function with ctx.

ids = []
discord_id = ctx.message.author.id
ids.append(discord_id)

I am not sure if this answer is clear enough but try to give more context when asking a question.

PS: don't use list as a name for a list, it will break your code.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Get elements from list in python

Remove multiple elements from a list of index with Python

Delete elements from python array with given index of elements as list

Get unique combinations of elements from a python list

Get all elements from JSON into a list in python

Python get intersection of elements from list of lists

Python delete all elements from a list that are on an odd index

How to get the more repeated combination of list elements from a python list

how to get subset of list from index of list in python

inserting all the elements from a list into specific index of sublist from a second list - python 2

Get single elements from nested list based on index position indecated of the value in a second list

Get inner-most elements from triple nested list Python

Python get sublist of n elements from unique permutations of a list

python quickly get index of elements in bigger list which also exists in a smaller list

How to get list elements by index in elixir

Get index range of the repetitive elements in the list

Compare two list and get the index of same elements

How to get index of elements in a nested list kdb

Python - get index from nested list where condition is met

How to filter entries from a list based on a criteria and get the index in Python?

python code to get ending brace index from list

How to get rid of headers and index from the Python list?

finding the index of the elements appended to new list from its old list - python 2

Get index value from a list

Extract same index elements from a list

Retrieve array elements from a list of index

How to delete elements from a List synchronously by Index?

Naming elements of a nested list from their index in R

Remove elements from a List at a specific index