def you_func(d):
result = set()
for k, v in d.items():
r, g, b = k.index('R'), k.index('G'), k.index('B')
for color in v:
result.add((color[r], color[g], color[b]))
return result
def f(d):
return {(c[k.index('R')], c[k.index('G')], c[k.index('B')]) for k, v in d.items() for c in v}
from datetime import datetime
import requests
now = datetime.now().strftime('%Y-%m-%d_%H-%M')
string_that_you_need = now + '.mp4' # Сейчас это выглядит, как "2015-04-29_10-59.mp4"
request = requests.get('http://site.that/you/need/%s' % string_that_you_need)
f = open('file.mp4', 'wb')
f.write(request.content)
f.close()
for i in range(len(lines)):
line = lines[i]
- это не по-пайтоновски.for line in lines:
# line уже определена
import requests
params = {
'arg1': 'demo',
'arg2': 'password',
'arg3': 'demo@gmail.com',
# И так далее.
}
auth = ('admin', 'p4ssw0rd')
url = 'https://server.vestacp.com:8083/api/'
r = requests.post(url, params=params, auth=auth)
if r.text == 0:
print('OK')
else:
print('Error code: %s' % r.text)