22 lines
629 B
Python
22 lines
629 B
Python
import csv
|
|
|
|
"""
|
|
Leer CSV - csv.reader(archivo.csv)
|
|
"""
|
|
with open('ejm.csv', 'r') as csv_arch:
|
|
reader = csv.reader(csv_arch)
|
|
for row in reader:
|
|
#print('\t'.ljust(2).join(row))
|
|
print('{0:8}\t{1:8}\t{2:8}\t{3:8}'.format(*row))
|
|
#print('{0:8}\t{1:8}\t{2:8}\t{3:8}'.format(row[0], row[1], row[2], row[3]
|
|
|
|
#print('\n', help(row)) # las filas son listas
|
|
|
|
"""
|
|
Escribir CSV - csv.writer(arch.csv).writerow(['elementos','a','escribir'])
|
|
"""
|
|
with open('ejm.csv', 'a') as csv_arch:
|
|
writer = csv.writer(csv_arch)
|
|
writer.writerow(['Elvira', 'Zápáté', '34467845', 'lervielpare@zumail.zen'])
|
|
|