This is a function that allows me to print my two lists, cursosArreglo
and tareasArreglo
, but when I print them they come out like this: [['qwert'], ['fisica']]
Esta es la lista de tareas y sus prioridades:
[['zxcvb'], ['4'], ['nbvcx'], ['3'], ['tregd'], ['2'], ['bvxx'], ['3']]
how can i print both lists without the brackets?
def verTareas():
print("")
print("Saludos "+nombre+(" a continuacion puede ver su informacion"))
print("")
print("Esta es la lista de cursos asignados: ")
print str(cursosArreglo)
print("Esta es la lista de tareas y sus prioridades: ")
print '\n'+str(tareasArreglo)
print("")
regresar()
Here's some code that works without any modules or anything.
for i in range(len(cursosArreglo)):
cursosArreglo[i] = "".join(cursosArreglo[i])
print(", ".join(cursosArreglo))
You can also run this for tareasArreglo
by substituting it in for cursosArreglo
.
This first goes through your list of lists, then substitutes each spot in the list with a string version of it, by using str.join()
, then str.join
again to fully join the list.
This can also be compressed into one line.
strCursosArreglo = ", ".join("".join(i) for i in cursosArreglo)
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments