S
S
Skrayvee2021-08-27 22:36:52
Python
Skrayvee, 2021-08-27 22:36:52

How to check user for value in string?

There is such business:
I need to check users on value in a column. There may be several, or maybe one.

I tried many times to implement this, but it only turned out like this:

adms = ''
admins = db.db_admin()
for admin in admins:
  admin = str(admin[2])
  adms += admin

subs = ''
subscribers = db.db_subs()
for sub in subscribers:
  sub = str(sub[2])
  subs += sub

bans = ''
banned = db.db_bans()
for ban in banned:
  ban = str(ban[2])
  bans += ban

users = ''
usrs = db.db_users()
for user in usrs:
  user = str(user[2])
  users += user

actusers = ''
actusrs = db.db_actusers()
print(actusrs)
for actuser in actusrs:
  actuser = str(actuser[2])
  actusers += actuser


This works when I change the value and the user is actually added to the row

BUT

If I remove the value for someone, it should be removed from the row, but it stays there since nothing clears it from there.
Further, the bot thinks that the user still has this value, since it is in the line.

Is there another way to check for a value?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Skrayvee, 2021-08-29
@Skrayvee

I found a way to delete users:

list.index(id)
>>> 3
del list[3]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question