Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created November 9, 2020 05:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/97e4655e943cb39bf3afb1238fb091e7 to your computer and use it in GitHub Desktop.
Save parzibyte/97e4655e943cb39bf3afb1238fb091e7 to your computer and use it in GitHub Desktop.
"""
https://parzibyte.me/blog
"""
nombre_archivo = "videojuegos.csv"
with open(nombre_archivo, "r") as archivo:
# Omitir el encabezado
next(archivo, None)
for linea in archivo:
# Remover salto de línea
linea = linea.rstrip()
# Ahora convertimos la línea a arreglo con split
separador = ","
lista = linea.split(",")
# Tenemos la lista. En la 0 tenemos el nombre, en la 1 la calificación y en la 2 el precio
nombre = lista[0]
calificacion = int(lista[1])
precio = float(lista[2])
print(
f"Juego: '{nombre}' con calificación {calificacion} y precio {precio}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment