-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcodeTries.txt
108 lines (97 loc) · 1.98 KB
/
codeTries.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
>>> for node in doc.getElementsByTagName("TOPICS"):
... L = node.getElementsByTagName("D")
... for node2 in L:
... for node3 in node2.childNodes:
... if node3.nodeType == Node.TEXT_NODE:
... print node3.data
...
cocoa
>>> for node in doc.getElementsByTagName("REUTERS"):
... L = node.getElementsByTagName("TITLE")
... for node2 in L:
... title = ""
... for node3 in node2.childNodes:
... if node3.nodeType == Node.TEXT_NODE:
... title += node3.data
... print title
...
BAHIA COCOA REVIEW
STANDARD OIL <SRD> TO FORM FINANCIAL UNIT
TEXAS COMMERCE BANCSHARES <TCB> FILES PLAN
TALKING POINT/BANKAMERICA <BAC> EQUITY OFFER
>>> for node in doc.getElementsByTagName("REUTERS"):
... topic = node.getAttribute("TOPICS")
... print topic
...
YES
NO
NO
NO
>>> for node in doc.getElementsByTagName("REUTERS"):
... L = node.getElementsByTagName("DATE")
... for node2 in L:
... if node2.nodeType == Node.TEXT_NODE:
... for node3 in node2.childNodes:
... if node3.nodeType == Node.TEXT_NODE:
... print node3.data
...
26-FEB-1987 15:01:01.79
26-FEB-1987 15:02:20.00
26-FEB-1987 15:03:27.51
26-FEB-1987 15:07:13.72
>>> for node in doc.getElementsByTagName("REUTERS"):
... lewisSplit = node.getAttribute("LEWISSPLIT")
... print lewisSplit
... cgiSplit = node.getAttribute("CGISPLIT")
... print cgiSplit
...
TRAIN
TRAINING-SET
TRAIN
TRAINING-SET
TRAIN
TRAINING-SET
TRAIN
TRAINING-SET
>>> for node in doc.getElementsByTagName("REUTERS"):
... topics = node.getAttribute("TOPICS")
... print topics
... lewisSplit = node.getAttribute("LEWISSPLIT")
... print lewisSplit
... cgiSplit = node.getAttribute("CGISPLIT")
... print cgiSplit
... oldId = node.getAttribute("OLDID")
... print oldId
... newId = node.getAttribute("NEWID")
... print newId
...
YES
TRAIN
TRAINING-SET
5544
1
NO
TRAIN
TRAINING-SET
5545
2
NO
TRAIN
TRAINING-SET
5546
3
NO
TRAIN
TRAINING-SET
5547
4
YES
TRAIN
TRAINING-SET
5548
5
YES
TRAIN
TRAINING-SET
5549
6