Example.
import csv
with open('csv_data.csv') as csvfile:
reader = csv.reader(csvfile, delimiter=';')
for row in reader:
print(','.join(row))
Output:
name, age, number
Salah, 22, 1, 26/01,
ali, 23, 2, 26/01,
Ranard, 30, 3, 26/01
For Pandas look at this
post.
(Jan-27-2019, 06:58 PM)salahoum Wrote: [ -> ]I explained my problem but the idea did not arrive
I simply re-explain
the videos in YouTube they read the data from the csv file like:
name, age, number, and the date; Salah; 22; 1; 26/01; ali; 23; 2; 26/01; Ranard; 30; 3; 26/01
I need to display it as:
name number date
salah 22 1 1/26
ali 23 2 26/01
ranard 30 3 26/01
There are three column headers (name, number, date) but four data columns separated by tab. Is it typo? What does mean 'display'? Is there one long row or data is on separate rows?
Based on limited knowledge a would propose something along those lines:
>>> s = ['name; age; number; date',
... 'Salah; 22; 1; 26/01',
... 'ali; 23; 2; 26/01',
... 'Ranard; 30; 3; 26/01']
>>> for row in s:
... print(*row.split(';'))
name age number date
Salah 22 1 26/01
ali 23 2 26/01
Ranard 30 3 26/01