Hello, I have a csv file, using the ";" as a delimiter. This file
contains addresses. My problem is that some fields are missing in some
rows and I would like to normalize the rows for a smoother import into
Excel, for example.
Here is an example. This is the header:
Company;Telephone;Address;Prov;PCode
While most of them have this header, some data would be like this:
Abc blaba;403-403-4545;MB ---> missing address, city, and postal code
Acme;123-403-4545;Winnipeg;MB;
I think a good solution would be to add delimiter to represent empty fields:
Abc blaba;403-403-4545;;;MB; -->missing address and postal code
Acme;123-403-4545;;Winnipeg;MB;

Fortunately the source has province names abbreviated (2 letters). I
could also take into account a postal code, maybe:
Given I have 2 simple functions:
isProvince()
isPostalCode():
How I would write to the proper fields once that was returned true?
Province has to go to row[3], and PCode to row[4] right?


Eduardo
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to