if cursor.execute("SELECT cash FROM users WHERE id = {}".format(ctx.author.id)).fetchone()[0] != None:
fetchone() вернул вам None, и вы далее обращаетесь к "первому" элементу None.user_id = 1 # id пользователя
result = cursor.execute("SELECT cash FROM users WHERE id = ?",(user_id,)).fetchone()
if result != None:
print('User found!')
else:
print('Error! User not found!')
import json
with open('iptv_Западные хиты - копия.fav') as file:
data = file.read()
j = json.loads(data)
import json
with open('iptv_Западные хиты - копия.fav') as file:
data = file.read()
j = json.loads(data)
file = open('playlist.m3u8','w')
for x in j:
j2 = json.loads(x['data'])
url = j2['url']
title = j2['title']
file.writelines('#EXTINF:-1,'+title+'\n')
file.writelines(url+'\n')
file.close()
class Dict(dict):
def __new__(cls, *args, **kwargs):
self = dict.__new__(cls, *args, **kwargs)
self.__dict__ = self
return self
json_data = {
"name": "Terminal",
"packageName": "application",
"order": 20,
"versionName": "1.37"
}
a = Dict(json_data)
print(a.name)
print(a.packageName)
print(a.order)
print(a.versionName)
sergey@sergey-X55A:~$ /usr/bin/python3 "/home/sergey/Рабочий стол/main.py"
Terminal
application
20
1.37