In Python, a list is a ordered collection of values. Here are some examples of lists and how they are
used:
patientids = [42446, 42113, 42007]
patientinfo = ["JohnDoe", 42446, "Admitted", 1000]
segmentlist = ["MSH", "EVN", "PID", "NK1", "PV1"]
segment = segmentlist[1] # assigns second element of segmentlist, which is "EVN"
for segment in segmentlist:
print segment, "is a segment in the list"
Lists are always enclosed in brackets ([]). Elements of a list are separated by a comma (,). A list
can contain strings, numbers, or a mixture of both. Lists can even contain other lists.
The following sections provide more information on how to use lists: