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cw4AAABlbnRlciBzZXJpYWw6ICgHAAAAdA0AAABDcnlwdG8uQ2lwaGVyUgAAAABSEAAAAFIMAAAAUhUAAAB0CQAAAHJhd19pbnB1dFIIAAAAKAAAAAAoAAAAACgAAAAAcwgAAAA8c3RyaW5nPnQIAAAAPG1vZHVsZT4DAAAAcwwAAAAQAQwCCQcJBQwBDAE='
>>> import base64
>>> import marshal
>>> b= marshal.loads(base64.b64decode(s))
>>> import dis
>>> dis.dis(b)
3 0 LOAD_CONST 0 (-1)
3 LOAD_CONST 1 (('AES',))
6 IMPORT_NAME 0 (Crypto.Cipher)
9 IMPORT_FROM 1 (AES)
12 STORE_NAME 1 (AES)
15 POP_TOP
4 16 LOAD_CONST 0 (-1)
19 LOAD_CONST 2 (None)
22 IMPORT_NAME 2 (base64)
25 STORE_NAME 2 (base64)
6 28 LOAD_CONST 3 (<code object check at 0x105d2fd30, file "<string>", line 6>)
31 MAKE_FUNCTION 0
34 STORE_NAME 3 (check)
13 37 LOAD_CONST 4 (<code object generate_flag at 0x105d2fe30, file "<string>", line 13>)
40 MAKE_FUNCTION 0
43 STORE_NAME 4 (generate_flag)
18 46 LOAD_NAME 5 (raw_input)
49 LOAD_CONST 5 ('enter serial: ')
52 CALL_FUNCTION 1
55 STORE_NAME 6 (serial)
19 58 LOAD_NAME 3 (check)
61 LOAD_NAME 6 (serial)
64 CALL_FUNCTION 1
67 POP_JUMP_IF_FALSE 84
20 70 LOAD_NAME 4 (generate_flag)
73 LOAD_NAME 6 (serial)
76 CALL_FUNCTION 1
79 PRINT_ITEM
80 PRINT_NEWLINE
81 JUMP_FORWARD 0 (to 84)
>> 84 LOAD_CONST 2 (None)
87 RETURN_VALUE
>>>
import json
myjson = """
{
"accounts": [
{
"alias": "string",
"balance": {
"amount": 0,
"currency": 0
},
"bankAlias": "string",
"currency": 0,
"defaultAccount": true,
"fsAlias": "string",
"hasBalance": true,
"title": "string",
"type": {
"id": "string",
"title": "string"
}
}
]
}
"""
data = json.loads(myjson)
print data["accounts"][0]["balance"]["amount"]
for x in responsedata['data']:
for x in responsedata['data'][:30]:
for item in responsedata['data'][:30]:
for ph in item['SearchedWith']:
print '%s:%s' % (ph['Phrase'], ph['Shows'])
b = str(ph['Phrase'].encode('utf8'))
c = str(ph['Shows'])
# записываем в файл каждую фразу, полученную от Яндекса
f.write(b + ':' + c + '\n')
from elasticsearch import Elasticsearch, helpers
es = Elasticsearch()
def mybulk_delete(q, index, doc_type):
res = helpers.scan(es,
query={"query": q},
index=index, doc_type= doc_type)
for r in res:
yield {"delete" : { "_index" : r["_index"], "_type" : r["_type"], "_id" : r["_id"] } }
q = {"query":{"term":{"user":"kimchy"}}}
k = (i for i in mybulk_delete(q,"myindex", "mytype"))
helpers.bulk(es, k, refresh = True)
pip install Flask
from flask import Flask
import mycode # здесь импортируете свои функции
app = Flask(__name__)
@app.route("/")
def hello():
# return "Hello World!"
return mycode.myfinc()
FLASK_APP=hello.py flask run
[buff_dict[nums[i]], i]
- это расшифровывается такnums[i]
- получить элемент с индексом i из массива nums (назовем его a)buff_dict[a]
- получить из словаря элемент по ключу nums[i] (назовем его b)return [b,i]
- возвратить новый массив из двух элементовa = nums[i]
b = buff_dict[a]
return [b,i]