first question coming up...have just started using Python 3.6. I am creating an XML format document of tabulated data. The document object itself has a collection called CellValues. Using Dimensions (aka Unicom Intelligence) I can read this collection as a record set and loop round it with .movenext() etc. However when I read it in Python with:
rs=tomdoc.tables["T0"].cellvalues()
for val in rs:
print(val)
I only see the first line. In contrast, when I connect to a SqL database, the returned object is a SQLrows type and prints the whole thing, but this one says it's CDispatch. How can I get it to either loop round or show me the whole recordset? Apologies for my ignorance and thanks in advance :)
Thanks to a colleague, I do now have a working process. In fact the collection needs to be indexed this way:
rs = tomdoc.Tables("T0").CellValues
Then it can be read as one normally would read a SQL-type record set:
rs.MoveFirst()
while not rs.EOF:
rowStr = ""
for f in rs.Fields:
rowStr += f.value + "\t"
print(rowStr)
rs.MoveNext()
I'm not sure why the ["T0"] gave me the first line though - that threw me somewhat and made it look closer than it actually was (one of those jolly things one encounters when mixing objects) so I didn't investigate alternatives for that part of the script :(
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.