Using Dictionary

Steven D'Aprano steve+comp.lang.python at pearwood.info
Tue Apr 14 15:52:41 CEST 2015


On Tue, 14 Apr 2015 11:34 pm, Pippo wrote:

> How can I use dictionary to save the following information?
> 
> #C[Health]
> #P[Information]
> #ST[genetic information]
> #C[oral | (recorded in (any form | medium))]
> #C[Is created or received by]
> #A[health care provider | health plan | public health authority | employer
> #| life insurer | school | university | or health care clearinghouse]
> #C[Relates to] C[the past, present, or future physical | mental health |
> #condition of an individual] C[the provision of health care to an
> #individual] C[the past, present, or future payment for the provision of
> #health care to an individual]


I don't understand the question. Can you explain what you mean by "save"?
Which part of the information? All of it?

text = """
#C[Health]
#P[Information]
#ST[genetic information]
#C[oral | (recorded in (any form | medium))]
#C[Is created or received by]
#A[health care provider | health plan | public health authority | employer |
life insurer | school | university | or health care clearinghouse]
#C[Relates to]
#C[the past, present, or future physical | mental health | condition of an
individual]
#C[the provision of health care to an individual]
#C[the past, present, or future payment for the provision of health care to
an individual]
"""
adict = {None: text}

Now you have the information inside a dict. Is that what you want? If not,
can you show an example of what result you hope to get at the end.



-- 
Steven




More information about the Python-list mailing list