Aun sigo batallando con un proyecto el cual necesito de su ayuda.
Tengo un archivo de .txt que contiene esto:
y necesito convertirlo a una matriz como esta:
matriz_citas =[
["lunes","martes","miercoles","jueves","viernes"],
["7:00am","7:00am","7:00am","7:00am","7:00am"],
["8:00am","8:00am","8:00am","8:00am","8:00am"],
["9:00am","9:00am","9:00am","9:00am","9:00am"],
["10:00am","10:00am","10:00am","10:00am","10:00am"],
["11:00am","11:00am","11:00am","11:00am","11:00am"],
["1:00pm","1:00pm","1:00pm","1:00pm","1:00pm"],
["2:00pm","2:00pm","2:00pm","2:00pm","2:00pm"],
["3:00pm","3:00pm","3:00pm","3:00pm","3:00pm"],
["4:00pm","4:00pm","4:00pm","4:00pm","4:00pm"],
["5:00pm","5:00pm","5:00pm","5:00pm","5:00pm"]]
No puedo usar librerías de ningún tipo, encontré otra publicación similar pero el código no funcionó
Usé este código:
with open("Horario.txt", "r") as datos:
valores = []
for linea in datos:
valores.append([str(x) for x in linea.strip().split(",")])
print(valores)
Pero ese código me crea una matriz diferente y no me deja trabajar en ella:
Alguno sabe como puedo hacerlo y que me quede la matriz a como la necesito