-
-
Save parzibyte/97e4655e943cb39bf3afb1238fb091e7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
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