<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2800.1515" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>Hi All,</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>I need extract the content of an XST file to
dictionary object..</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>below is content of that file </FONT></DIV>
<DIV><FONT face=Arial
size=2>----------------------------------------------------------------------------------------</FONT></DIV>
<DIV><FONT face=Arial size=2>from work centre XST</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>[description
XRX_DSCRPT_METADATA]<BR> field_0{<BR> string
MetaDataFieldName = "title";<BR> string MetaDataPrompt =
"Title";<BR> string MetaDataType =
"string";<BR> string MetaDataValue = "Student
Letter";<BR> }<BR> field_1{<BR> string
MetaDataFieldName = "collectionname";<BR> string
MetaDataPrompt = "CollectionName";<BR> string
MetaDataType = "string";<BR> string MetaDataValue =
"999888777666";<BR> }<BR> field_2{<BR> string
MetaDataFieldName = "summary";<BR> string MetaDataPrompt
= "Summary";<BR> string MetaDataType =
"string";<BR> string MetaDataValue =
"newman";<BR> }</FONT></DIV>
<DIV> </DIV><FONT face=Arial size=2>
<DIV><BR>[description
xrx_dscrpt_metadata]<BR>entry_1{<BR> string
MetaDataFieldName = "Job Reference";<BR> string
MetaDataPrompt = "Job Reference";<BR> string
MetaDataDefaultValue = "";<BR> string
MetaDataValue =
"jgutbcfrvewf";<BR> }<BR>entry_2{<BR> string
MetaDataFieldName = "Price Text";<BR> string
MetaDataPrompt = "Price Text";<BR> string
MetaDataDefaultValue = "";<BR> string
MetaDataValue =
"758bf6";<BR> }<BR>---------------------------------------------------------------------------</DIV>
<DIV> </DIV>
<DIV>I want a hash to be build based on the content like resulthash
={1:{"MetaDataFieldName" :"Price Text","MetaDataPrompt":"Price
Text","MetaDataDefaultValue" :"","MetaDataValue":"758bf6",}, and so on for
all ocuurences..}</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>I started using file objects ..and was thinking is a better way to
approach this scenario</DIV>
<DIV> </DIV>
<DIV>from os.path import *<BR>filename="c:\sxtfile.xst";<BR>if
exists(filename):<BR> if
isfile(filename):<BR> f = open(filename,
"rb")<BR> for line in
f.readlines():<BR>
print line<BR> else:<BR> print
"I cannot see a file of this name" </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>cheers</DIV>
<DIV> </DIV></FONT>
<DIV><FONT face=Arial
size=2>-----------------------------------------------------<BR>Thomas
Thomas</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2>phone +64 7 855
8478<BR>fax +64 7 855
8871</FONT></DIV></BODY></HTML>