@acwoss/

TwinAngelicWorkplaces

Python

No description

fork
loading
Files
  • main.py

This Plugin Crashed!

Error: Error: must not create an existing file {"type":"CREATE_FILE","wid":"0.6668454103573831","path":"main.py","file":{"path":"main.py","content":{"asEncoding":{"base64":"ZnJvbSBpdGVydG9vbHMgaW1wb3J0IHByb2R1Y3QsIGNoYWluCgpsaXN0YSA9IFtbJ2p1bGlhbicsICcwJywgJzQnLCAnNCddLCBbJ2FuYScsICcxMCcsICc0J11dCgpkZWYgZ2V0X2FsbF9pbmRleGVzKGxpc3RhLCB2YWxvcik6CiAgICByZXR1cm4gKGkgZm9yIGksIHYgaW4gZW51bWVyYXRlKGxpc3RhKSBpZiB2ID09IHZhbG9yKQogICAgCmRlZiBzZWFyY2gobGlzdGEsIHZhbG9yKToKICAgIHJldHVybiAobGlzdChwcm9kdWN0KFtpbmRpY2VdLCBnZXRfYWxsX2luZGV4ZXMoc3VibGlzdGEsIHZhbG9yKSkpIAogICAgICAgIGZvciBpbmRpY2UsIHN1Ymxpc3RhIGluIGVudW1lcmF0ZShsaXN0YSkgaWYgdmFsb3IgaW4gc3VibGlzdGEpCiAgICAgICAgCnByaW50KCBsaXN0KHNlYXJjaChsaXN0YSwgJzQnKSkgKQ=="},"asBuffer":null},"loaded":true}}
1
2
3
4
5
6
7
8
9
10
11
12
from itertools import product, chain

lista = [['julian', '0', '4', '4'], ['ana', '10', '4']]

def get_all_indexes(lista, valor):
    return (i for i, v in enumerate(lista) if v == valor)
    
def search(lista, valor):
    return (list(product([indice], get_all_indexes(sublista, valor))) 
        for indice, sublista in enumerate(lista) if valor in sublista)
        
print( list(search(lista, '4')) )