我的UML图是这样的:
rootNode
|
Book (attribute:name)
|
Table (attribute: Name)
|
TableEntry(attribute: Field, Value)
当我使用此代码时:
for Book in rootNode.getBooks():
print Book.getName()
for Table in Book.getTables():
print Table.getName()
for TableEntry in Table.getTableEntrys():
print TableEntry.getField(), TableEntry.getValue()
输出如下:
Document
T1
F1 V1
F2 V2
F3 V3
F4 V4
F5 V5
F6 V6
T2
F1 V1
F2 V2
F3 V3
F4 V4
F5 V5
F6 V6
Document
T2
F2 V2
F3 V3
F4 V4
F5 V5
F6 V6
我希望将每个字段和值的文档(第一个)中的字段和值ex-F1和值V1与文档(第二个)中的F1 V1进行比较。 我对两个文件都有相同的书名,即“文档”。 我也想在这两个文件中找到丢失的字段或附加字段,就像T2中我的F1和V1缺失一样。
答案 0 :(得分:1)
最佳解决方案是'=='来比较值
and
如果您想与实体进行比较,请使用'is'
例如=>
α= 123; B = 123;
a是b
输出:
是真的