Graphics Reference
In-Depth Information
in a string such as 25kb , so the kb is removed, and the remaining string is
converted into an integer.
kb = int(row[4].replace("kb",""))
Creating a Distribution List
The list of people in the e-mail distribution is spread out across three
columns ( from , to , cc ), and each of these can contain zero, one, or many
people. To make this easier to work with, you create a distribution list, as
shown here:
distlist = [];
for i in range(0,3):
names =
row[i].replace('"','').split(';')
for name in names:
name = name.strip()
if (name!=""):
distlist.append(name)
First, you create an empty list to assemble all the names.
distlist = [];
Then you create a loop to go through the first three items in the row, (that
is, the from , to , and cc fields).
for i in range(0,3):
names =
row[i].replace('"','').split(';')
For each field, there may be multiple people, which are separated with
semicolons, whitespace, and quotation marks. You create a list of names by
first removing the outer quotation marks and splitting the field based on the
semicolons.
This list of names is then iterated through. Any extraneous spaces are
removed via strip() . Because a field can be empty (for example, no one
wasCC'd),thereisalsoacheckforanemptyname. Ifthenameisnotempty,
it is appended to the distribution list.
Search WWH ::




Custom Search