Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

leer fichero de texto con columnas como diccionario python

def get_pair(line):
    key, sep, value = line.strip().partition(" ")
    return int(key), value

with open("file.txt") as fd:    
    d = dict(get_pair(line) for line in fd)
Source by www.it-swarm.dev #
 
PREVIOUS NEXT
Tagged: #leer #fichero #de #texto #columnas #como #diccionario #python
ADD COMMENT
Topic
Name
8+1 =