Attachment 'terminal_7.txt'
Download 1 odd% ipython --pylab
2 Leopard libedit detected.
3 Python 2.7.5 (default, Aug 25 2013, 00:04:04)
4 Type "copyright", "credits" or "license" for more information.
5
6 IPython 0.10 -- An enhanced Interactive Python.
7 ? -> Introduction and overview of IPython's features.
8 %quickref -> Quick reference.
9 help -> Python's own help system.
10 object? -> Details about 'object'. ?object also works, ?? prints more.
11
12 Welcome to pylab, a matplotlib-based Python environment.
13 For more information, type 'help(pylab)'.
14
15 In [1]: a=load
16 load loads loadtxt
17
18 In [1]: a=loadtxt("histdata1.txt")
19
20 In [2]: b=loadtxt("histdata2.txt")
21
22 In [3]: a
23 Out[3]:
24 array([ 2.0134, 2.6224, 5.7746, 2.8369, 3.2614, 2.656 , 3.6223,
25 3.6554, 3.2868, 2.0657, 2.6862, 1.6926, 3.0922, 2.7039,
26 3.3683, 2.4853, 3.8648, 2.0379, 3.3183, 3.0755, 1.3555,
27 3.2902, 2.6083, 4.3959, 3.7522, 1.808 , 3.1642, 2.8504,
28 3.8774, 2.4361, 4.4567, 3.0828, 2.1146, 1.8597, 2.77 ,
29 2.4807, 3.9702, 1.3325, 2.6439, 2.862 , 4.2029, 2.474 ,
30 2.0359, 3.6001, 2.993 , 4.47 , 3.1784, 2.9787, 3.7748,
31 3.6336, 3.6966, 3.2211, 2.5774, 2.5526, 2.6056, 5.269 ,
32 2.9264, 3.5267, 1.7489, 3.7437, 1.2507, 2.66 , 3.1657,
33 3.2095, 2.6424, 2.7375, 4.6389, 4.229 , 3.5875, 3.0073,
34 3.095 , 2.5555, 3.8165, 3.7475, 4.5773, 3.1289, 2.0872,
35 1.4804, 4.3969, 2.4179, 3.4434, 3.7939, 1.3123, 2.7653,
36 3.4534, 4.4413, 3.316 , 4.2663, 4.194 , 4.4798, 3.3501,
37 4.4896, 3.3822, 3.9453, 4.0602, 1.5663, 2.9714, 3.7838,
38 3.3183, 2.179 , 2.5838, 2.0677, 3.4643, 5.3662, 4.5902,
39 4.0406, 3.317 , 3.8112, 3.823 , 3.0532, 3.1867, 2.2311,
40 4.3458, 2.4033, 3.576 , 2.1502, 3.0044, 3.5235, 4.4605,
41 3.1126, 3.2096, 2.5096, 3.087 , 2.4469, 0.6499, 3.7746,
42 3.2018, 2.6577, 2.983 , 3.9557, 3.8617, 2.7079, 3.2073,
43 3.3082, 3.48 , 2.1339, 4.6674, 3.0822, 3.1889, 3.0733,
44 2.0992, 2.9251, 3.0716, 2.4659, 2.9711, 1.3295, 4.1822,
45 3.9412, 0.8924, 2.8145, 4.1992, 2.1415, 1.527 , 1.8861,
46 2.6271, 2.9286, 2.7741, 1.7129, 2.7369, 3.9712, 2.8179,
47 4.4221, 2.3358, 4.1518, 3.6526, 4.2279, 3.289 , 2.91 ,
48 1.6432, 4.4082, 2.3301, 2.7813, 2.3295, 3.2235, 2.9676,
49 4.3706, 3.1199, 1.7284, 3.3142, 3.1693, 2.1585, 2.5528,
50 3.1082, 2.9366, 3.8281, 2.9844, 4.5819, 2.5706, 2.763 ,
51 2.3505, 3.2101, 4.0892, 2.1903, 3.0165, 2.0047, 3.1603,
52 4.1298, 6.6751, 3.7919, 2.9756, 3.6774, 2.666 , 2.8439,
53 2.9861, 1.8288, 2.4905, 2.0056, 5.1684, 3.8051, 3.3954,
54 1.6442, 1.4282, 2.9656, 5.0751, 3.6537, 3.1188, 2.8787,
55 2.5376, 0.3308, 2.8935, 2.0858, 2.6495, 3.7738, 2.0829,
56 2.629 , 1.8846, 5.1122, 1.7751, 2.678 , 3.3349, 1.8351,
57 3.4508, 1.1964, 4.9798, 2.7387, 2.9407, 2.4422, 4.5975,
58 3.4423, 0.8234, 1.8951, 3.5873, 2.6119, 3.5062, 2.064 ,
59 2.3733, 2.2293, 3.4762, 1.8903, 3.1663, 3.7586, 2.2848,
60 3.8242, 2.1278, 3.3621, 2.5668, 3.952 , 2.4491, 0.9853,
61 2.6896, 1.9235, 5.0128, 3.9021, 2.1043, 4.7425, 2.7402,
62 2.8693, 3.6664, 4.0459, 2.6274, 1.6583, 3.5025, 2.892 ,
63 2.9577, 5.209 , 4.3026, 3.0877, 1.7383, 1.8898, 2.7384,
64 1.0794, 3.5301, 3.7552, 1.407 , 2.8622, 3.7295, 4.858 ,
65 2.4635, 3.7793, 3.2384, 4.4089, 3.3225, 2.3778, 2.3076,
66 4.9439, 5.6696, 2.5541, 3.0252, 3.5646, 3.8997, 4.1722,
67 3.4185, 3.6708, 3.0446, 2.1191, 3.2134, 2.3863, 2.7667,
68 2.9074, 3.1541, 0.5457, 2.8757, 1.1295, 3.3445, 3.7792,
69 3.528 , 2.8123, 4.4933, 3.8456, 3.6991, 2.2987, 2.7739,
70 2.1315, 2.883 , 2.3386, 2.194 , 1.8657, 1.2933, 4.268 ,
71 2.3774, 3.6588, 2.7608, 4.9662, 2.4479, 4.113 , 2.0715,
72 1.8663, 1.4849, 3.5808, 2.0483, 3.6297, 1.6243, 2.8825,
73 1.7392, 3.527 , 3.7003, 5.5906, 1.9473, 1.5108, 2.5639,
74 1.7735, 1.8087, 1.0004, 4.0187, 2.6567, 3.469 , 3.5493,
75 2.9454, 2.953 , 3.4241, 2.0206, 3.89 , 2.0386, 2.4817,
76 3.9967, 4.8849, 3.1513, 3.5105, 2.8321, 2.5911, 1.0256,
77 1.6449, 3.352 , 3.2481, 2.2557, 1.7433, 0.9567, 2.1366,
78 5.9993, 3.48 , 3.8243, 3.636 , 3.9888, 2.3322, 3.0434,
79 2.3334, 3.6714, 1.5638, 3.4916, 3.4246, 1.975 , 3.7941,
80 4.7432, 2.9456, 3.5746, 1.6418, 2.7193, 2.0262, 2.1748,
81 2.3424, 2.5045, 3.5092, 1.6157, 2.9731, 3.5656, 3.0805,
82 3.187 , 3.2451, 2.9783, 2.9506, 4.1542, 0.592 , 1.4788,
83 4.157 , 2.4463, 4.5872, 2.1907, 4.3241, 3.7729, 1.3564,
84 2.4558, 4.0476, 2.6088, 3.0333, 2.8118, 5.0076, 3.6027,
85 5.4724, 2.1597, 4.0922, 3.4699, 2.8353, 2.7715, 2.5317,
86 2.1543, 3.1357, 2.5893, 2.9935, 3.0297, 2.2329, 3.8067,
87 4.1991, 1.1236, 1.9284, 4.6825, 2.2003, 2.0537, 2.3156,
88 2.8955, 3.036 , 3.2317, 2.6157, 1.7985, 3.2512, 2.7914,
89 1.8775, 1.0957, 2.2556, 5.0971, 3.2858, 3.7435, 2.2257,
90 3.6781, 3.3031, 3.6825, 2.5988, 1.3274, 2.7136, 0.9103,
91 4.816 , 1.9461, 4.3595, 1.4406, 2.1612, 2.5226, 2.4826,
92 2.4138, 2.7349, 3.4671, 3.5708, 2.2068, 2.4412, 2.3247,
93 1.4733, 4.3363, 2.5239, 1.4565, 2.7798, 3.6526, 2.4543,
94 4.4078, 3.5212, 3.2591, 4.2809, 4.8274, 2.5775, 2.2102,
95 3.894 , 2.456 , 1.9179, 5.6815, 3.8855, 3.4883, 3.4427,
96 1.1505, 2.3709, 4.4697, 3.855 , 3.9826, 3.0488, 3.545 ,
97 4.4284, 3.3621, 1.489 , 3.8552, 2.519 , 3.3704, 3.613 ,
98 2.4402, 3.7997, 3.8655, 3.7798, 2.7982, 3.4903, 2.542 ,
99 1.1433, 4.8673, 2.6035, 1.8868, 1.5656, 2.4972, 2.6321,
100 3.7471, 1.9169, 2.6944, 3.8975, 2.789 , 2.4726, 4.9736,
101 2.545 , 2.587 , 2.4138, 2.85 , 4.5054, 4.4396, 1.8097,
102 3.4199, 2.8976, 2.8658, 2.3496, 3.8352, 1.8322, 3.2803,
103 0.8095, 3.4816, 3.3399, 2.5279, 1.512 , 2.6796, 2.3534,
104 2.1299, 3.8527, 2.9475, 3.1139, 1.966 , 3.3518, 2.9119,
105 2.3981, 3.0996, 1.2723, 5.1292, 2.4757, 4.5476, 2.81 ,
106 1.7774, 3.6754, 2.5585, 5.2356, 4.0011, 2.4127, 2.6227,
107 4.4564, 3.4971, 2.1598, 2.1937, 2.9093, 3.8848, 4.5576,
108 3.6506, 1.1866, 2.9977, 1.5115, 0.4059, 2.1075, 4.7976,
109 2.7134, 5.135 , 4.9536, 4.9927, 2.4828, 3.5698, 0.4588,
110 2.3906, 3.8702, 1.5727, 2.8838, 2.0937, 4.473 , 2.5134,
111 2.777 , 1.8295, 4.5999, 2.8697, 2.0159, 4.4006, 3.1884,
112 0.4903, 3.1372, 3.249 , 2.5389, 1.7257, 3.6092, 4.0188,
113 4.6414, 4.3543, 3.5676, 2.7747, 1.9255, 3.9313, 1.1341,
114 2.756 , 2.0618, 2.079 , 3.6387, 2.2431, 2.8 , 3.0068,
115 3.3533, 4.2931, 1.5296, 2.4378, 2.4366, 1.8777, 2.8312,
116 3.0417, 3.6814, 2.2283, 2.0695, 3.8955, 4.717 , 3.6737,
117 4.6961, 3.0322, 3.7067, 2.3846, 1.8775, 3.1586, 5.2754,
118 1.6878, 2.6017, 2.2994, 2.362 , 4.206 , 2.0982, 4.9576,
119 5.4262, 2.6825, 2.5562, 4.2862, 1.8333, 4.713 , 2.5869,
120 2.3244, 5.6835, 2.392 , 4.118 , 2.6143, 3.2375, 1.4051,
121 4.9722, 2.4485, 1.9901, 2.6908, 3.4364, 1.0464, 2.3099,
122 3.312 , 2.9148, 4.0991, 3.6585, 3.2099, 4.2828, 2.4381,
123 3.4717, 3.6745, 2.8021, 3.5961, 2.2384, 3.9598, 2.6388,
124 4.8637, 3.0839, 3.7479, 5.2097, 3.7608, 3.8739, 3.3612,
125 4.109 , 0.2752, 1.8033, 2.0496, 2.8653, 2.8823, 3.8263,
126 4.0888, 2.6144, 3.0979, 2.5685, 2.4068, 3.1385, 3.5778,
127 2.4523, 3.4073, 3.8031, 2.5129, 3.0201, 2.8072, 1.5045,
128 1.1677, 3.1675, 2.9365, 3.9741, 2.8664, 2.6105, 3.3968,
129 3.563 , 2.8537, 2.9068, 1.2125, 2.0298, 3.7314, 2.5773,
130 2.1175, 2.5953, 2.7999, 2.6684, 2.2252, 2.7797, 3.2125,
131 2.8999, 1.5419, 3.3288, 2.5859, 2.9842, 1.865 , 3.0756,
132 2.1342, 3.8843, 3.5755, 3.2804, 3.5685, 5.0002, 3.4359,
133 3.3625, 0.7706, 3.7663, 1.8618, 2.8896, 2.4259, 2.332 ,
134 2.3872, 2.2908, 2.7176, 4.0512, 1.7232, 2.7859, 3.4434,
135 4.483 , 2.9614, 1.2256, 3.2177, 2.1604, 2.9058, 3.3365,
136 2.3659, 2.4518, 4.7446, 2.3856, 3.299 , 3.2128, 3.8343,
137 1.1437, 2.0435, 2.8879, 2.3982, 2.9398, 3.1356, 3.268 ,
138 2.5339, 3.1564, 1.8357, 3.2365, 2.7647, 4.4044, 2.2058,
139 3.0441, 4.1107, 2.7827, 4.6328, 1.7958, 5.4782, 1.4612,
140 2.8039, 2.6148, 1.9064, 2.511 , 2.8062, 1.7377, 4.4235,
141 3.7076, 2.7087, 2.4029, 2.8387, 1.2578, 1.9326, 1.5181,
142 4.5414, 2.5002, 4.015 , 1.557 , 3.2389, 4.1398, 2.5352,
143 2.911 , 3.4008, 1.7695, 3.2067, 2.1729, 3.4031, 3.1879,
144 5.0555, 3.3652, 1.0477, 2.4723, 1.7521, 5.2229, 2.2639,
145 2.234 , 5.1122, 3.1843, 3.4478, 0.2837, 3.9181, 2.0271,
146 2.8663, 3.7125, 1.2974, 4.3876, 1.1303, 2.9645, 3.476 ,
147 3.2364, 3.0695, 5.144 , 3.2498, 4.3651, 4.4682, 2.6531,
148 2.9807, 2.0479, 2.3779, 2.7862, 3.0499, 2.0312, 2.4107,
149 3.8381, 2.507 , 2.9196, 3.78 , 2.9817, 2.1584, 1.8903,
150 2.9787, 3.7949, 1.6573, 3.0544, 1.3575, 3.5224, 1.8072,
151 4.3951, 2.3951, 3.1053, 3.7401, 3.8021, 4.2505, 1.6905,
152 1.4254, 2.5044, 3.6842, 2.0586, 4.227 , 1.7275, 3.6541,
153 3.3495, 3.051 , 1.3256, 3.3418, 4.1087, 2.4969, 3.0115,
154 2.5578, 5.7205, 3.3586, 1.3029, 0.5194, 5.5226, 3.5281,
155 4.6672, 3.3893, 3.9302, 3.8678, 2.0793, 4.6076, 5.7906,
156 2.6957, 2.606 , 4.3529, 3.0135, 3.3082, 5.8244, 3.5259,
157 2.7441, 3.1388, 3.0429, 3.3518, 4.632 , 1.6164, 1.5595,
158 3.8103, 3.2797, 2.7714, 3.3208, 2.2617, 3.5458, 1.8137,
159 0.6717, 0.8929, 3.3638, 4.2454, 1.0655, 4.6256, 3.5767,
160 2.419 , 3.0785, 2.4766, 3.2103, 0.6125, 1.7086, 2.1093,
161 2.5796, 2.3338, 3.2698, 3.7453, 3.2059, 1.0629, 2.4088,
162 4.2543, 2.6125, 3.5189, 2.2097, 2.7562, 2.7547, 3.8668,
163 2.5677, 1.7247, 4.1555, 2.737 , 3.0676, 3.3919, 2.1786,
164 2.5627, 3.5069, 3.3588, 4.7789, 4.1703, 3.559 , 4.4675,
165 2.5241, 4.4275, 2.227 , 2.9682, 2.9876, 4.6851, 3.7605,
166 1.3309, 3.641 , 1.3291, 2.3397, 2.3524, 2.8794])
167
168 In [4]: b
169 Out[4]:
170 array([ 9.343 , 9.573 , 9.037 , 8.8433, 7.7609, 8.3931,
171 10.766 , 10.6243, 10.6836, 10.4651, 10.419 , 10.7995,
172 9.868 , 12.0735, 10.1959, 11.2165, 11.6508, 9.7992,
173 9.2005, 7.9623, 9.792 , 10.0188, 7.5561, 8.0696,
174 10.4557, 9.3013, 10.8201, 9.9504, 11.0791, 9.8751,
175 10.6068, 10.8542, 11.2952, 9.149 , 9.9574, 11.7426,
176 8.4187, 10.2061, 9.3555, 10.1771, 11.1416, 8.9849,
177 9.8617, 10.4881, 10.3607, 11.3738, 11.6923, 9.855 ,
178 7.3159, 10.7411, 11.545 , 11.5143, 9.8599, 9.4272,
179 8.3419, 10.9025, 10.5702, 8.8627, 10.1716, 8.8083,
180 8.8942, 9.5712, 11.2293, 10.674 , 11.1485, 9.6245,
181 10.2337, 9.2893, 8.7843, 10.7568, 11.5173, 8.2839,
182 9.2305, 10.5135, 11.2245, 9.8489, 8.997 , 9.4968,
183 10.4165, 9.4463, 8.2471, 9.5298, 11.8921, 11.2362,
184 9.3872, 9.872 , 8.9137, 9.8766, 11.7623, 9.4914,
185 10.6748, 11.8513, 11.0107, 8.7185, 10.8008, 10.6677,
186 10.1096, 10.806 , 8.7573, 10.1235, 28.2018, 29.5671,
187 28.0938, 29.7175, 30.3894, 28.9658, 30.1979, 29.9517,
188 30.7537, 28.2613, 29.6978, 31.5529, 29.4547, 31.7271,
189 30.6811, 29.8217, 29.583 , 30.892 , 29.9813, 30.9416,
190 29.7124, 29.3681, 30.4734, 31.3882, 30.5914, 30.1083,
191 29.7536, 29.641 , 29.9673, 29.6892, 30.4156, 29.7274,
192 29.2203, 30.1479, 31.9466, 30.9339, 31.2723, 30.5969,
193 29.5755, 30.882 , 29.2268, 29.2009, 29.4555, 29.835 ,
194 30.5875, 31.2591, 31.2486, 27.5613, 30.5668, 29.4234,
195 30.5586, 29.5681, 30.5031, 28.7859, 28.5573, 30.1686,
196 29.6528, 28.2178, 31.2685, 30.8093, 29.5445, 30.5608,
197 31.9699, 29.6 , 27.7357, 31.5746, 28.5866, 30.6091,
198 30.206 , 29.7034, 29.0312, 30.0754, 30.3896, 28.2211,
199 29.4441, 30.8132, 29.8843, 30.3222, 30.5686, 28.07 ,
200 29.5828, 32.0818, 28.5589, 30.4089, 29.3044, 29.5299,
201 32.6982, 31.0889, 29.624 , 31.174 , 29.4505, 28.7707,
202 30.4745, 30.3665, 29.1405, 28.0112, 30.2656, 30.3837,
203 31.0028, 30.3895])
204
205 In [5]: hist(a)
206 Out[5]:
207 (array([ 18, 58, 137, 236, 238, 175, 89, 35, 13, 1]),
208 array([ 0.2752 , 0.91519, 1.55518, 2.19517, 2.83516, 3.47515,
209 4.11514, 4.75513, 5.39512, 6.03511, 6.6751 ]),
210 <a list of 10 Patch objects>)
211
212 In [6]: hist(b)
213 Out[6]:
214 (array([40, 60, 0, 0, 0, 0, 0, 1, 53, 46]),
215 array([ 7.3159 , 9.85413, 12.39236, 14.93059, 17.46882, 20.00705,
216 22.54528, 25.08351, 27.62174, 30.15997, 32.6982 ]),
217 <a list of 10 Patch objects>)
218
219 In [7]: hist(b,bins=30)
220 Out[7]:
221 (array([ 5, 15, 20, 31, 22, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
222 0, 0, 0, 0, 0, 0, 1, 8, 12, 33, 32, 10, 4]),
223 array([ 7.3159 , 8.16197667, 9.00805333, 9.85413 ,
224 10.70020667, 11.54628333, 12.39236 , 13.23843667,
225 14.08451333, 14.93059 , 15.77666667, 16.62274333,
226 17.46882 , 18.31489667, 19.16097333, 20.00705 ,
227 20.85312667, 21.69920333, 22.54528 , 23.39135667,
228 24.23743333, 25.08351 , 25.92958667, 26.77566333,
229 27.62174 , 28.46781667, 29.31389333, 30.15997 ,
230 31.00604667, 31.85212333, 32.6982 ]),
231 <a list of 30 Patch objects>)
232
233 In [8]: hist(b,bins=50)
234 Out[8]:
235 (array([ 3, 4, 7, 13, 13, 18, 21, 11, 8, 2, 0, 0, 0, 0, 0, 0, 0,
236 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
237 0, 0, 0, 0, 0, 1, 4, 7, 5, 20, 17, 23, 11, 7, 4, 1]),
238 array([ 7.3159 , 7.823546, 8.331192, 8.838838, 9.346484,
239 9.85413 , 10.361776, 10.869422, 11.377068, 11.884714,
240 12.39236 , 12.900006, 13.407652, 13.915298, 14.422944,
241 14.93059 , 15.438236, 15.945882, 16.453528, 16.961174,
242 17.46882 , 17.976466, 18.484112, 18.991758, 19.499404,
243 20.00705 , 20.514696, 21.022342, 21.529988, 22.037634,
244 22.54528 , 23.052926, 23.560572, 24.068218, 24.575864,
245 25.08351 , 25.591156, 26.098802, 26.606448, 27.114094,
246 27.62174 , 28.129386, 28.637032, 29.144678, 29.652324,
247 30.15997 , 30.667616, 31.175262, 31.682908, 32.190554, 32.6982 ]),
248 <a list of 50 Patch objects>)
249
250 In [9]: ^D
251 Do you really want to exit ([y]/n)?
252 odd% python
253 Python 2.7.5 (default, Aug 25 2013, 00:04:04)
254 [GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin
255 Type "help", "copyright", "credits" or "license" for more information.
256 >>> import urllib2
257 >>> f=urllib2.urlopen("http://blake.bcm.edu/dl/test.html")
258 >>> for i in f: print i
259 ...
260 <HTML>
261
262 <HEAD><TITLE>My Page</TITLE></HEAD>
263
264 <BODY>
265
266 <H3>Hi Everyone</H3>
267
268 <P>This is really just some test text to demonstrate how HTML works. I can do interesting
269
270 things like <i>italicize</i> or make text <b>bold</b>, or even <b><i>both together</i></b>. ta da
271
272 </BODY>
273
274 >>> ^D
275 odd% ipython
276 Leopard libedit detected.
277 Python 2.7.5 (default, Aug 25 2013, 00:04:04)
278 Type "copyright", "credits" or "license" for more information.
279
280 IPython 0.10 -- An enhanced Interactive Python.
281 ? -> Introduction and overview of IPython's features.
282 %quickref -> Quick reference.
283 help -> Python's own help system.
284 object? -> Details about 'object'. ?object also works, ?? prints more.
285
286 In [1]: from xml.etree import cElementTree
287
288 In [2]: !
289
290 In [3]: ^D
291 Do you really want to exit ([y]/n)? y
292 odd% ls
293 20140117114538 launch-VZEk7L
294 20140125123848 launch-wKcu4o
295 com.microsoft.office.updater launchd-247.PVLsIw
296 histdata1.txt launchd-248.dtS7UW
297 histdata2.txt launchd-530.tilNwM
298 launch-8GJkjI launchd-974.9dhnbj
299 odd% /Users/stevel/wp/lecture/2012_01_Intro_Programming/lec7/xml_example.xml
300 odd% cp /Users/stevel/wp/lecture/2012_01_Intro_Programming/lec7/xml_example.xml /tmp
301 odd% pwd
302 /tmp
303 odd% ls
304 20140117114538 launch-wKcu4o
305 20140125123848 launchd-247.PVLsIw
306 com.microsoft.office.updater launchd-248.dtS7UW
307 histdata1.txt launchd-530.tilNwM
308 histdata2.txt launchd-974.9dhnbj
309 launch-8GJkjI xml_example.xml
310 launch-VZEk7L
311 odd% more xml_example.xml
312 <?xml version="1.0" encoding="ISO-8859-1"?>
313 <CATALOG>
314 <PLANT>
315 <COMMON>Bloodroot</COMMON>
316 <BOTANICAL>Sanguinaria canadensis</BOTANICAL>
317 <ZONE>4</ZONE>
318 <LIGHT>Mostly Shady</LIGHT>
319 <PRICE CURRENCY="dollar">2.44</PRICE>
320 <AVAILABILITY>031599</AVAILABILITY>
321 </PLANT>
322 <PLANT>
323 <COMMON>Columbine</COMMON>
324 <BOTANICAL>Aquilegia canadensis</BOTANICAL>
325 <ZONE>3</ZONE>
326 <LIGHT>Mostly Shady</LIGHT>
327 <PRICE CURRENCY="dollar" >9.37</PRICE>
328 <AVAILABILITY>030699</AVAILABILITY>
329 </PLANT>
330 </CATALOG>
331
332 odd% ipython
333 Leopard libedit detected.
334 Python 2.7.5 (default, Aug 25 2013, 00:04:04)
335 Type "copyright", "credits" or "license" for more information.
336
337 IPython 0.10 -- An enhanced Interactive Python.
338 ? -> Introduction and overview of IPython's features.
339 %quickref -> Quick reference.
340 help -> Python's own help system.
341 object? -> Details about 'object'. ?object also works, ?? prints more.
342
343 In [1]: from xml.etree import cElementTree
344
345 In [2]: et=cElementTree.parse("xml_example.xml")
346
347 In [3]: et
348 Out[3]: <ElementTree object at 0x1014fa4d0>
349
350 In [4]: et.
351 et.__class__ et.__module__ et.__subclasshook__ et.getroot
352 et.__delattr__ et.__new__ et.__weakref__ et.iter
353 et.__dict__ et.__reduce__ et._root et.iterfind
354 et.__doc__ et.__reduce_ex__ et._setroot et.parse
355 et.__format__ et.__repr__ et.find et.write
356 et.__getattribute__ et.__setattr__ et.findall et.write_c14n
357 et.__hash__ et.__sizeof__ et.findtext
358 et.__init__ et.__str__ et.getiterator
359
360 In [4]: e=et.getroot()
361
362 In [5]: e
363 Out[5]: <Element 'CATALOG' at 0x1015427b0>
364
365 In [6]: e.tag
366 Out[6]: 'CATALOG'
367
368 In [7]: e[0]
369 Out[7]: <Element 'PLANT' at 0x101542480>
370
371 In [8]: e[0][0]
372 Out[8]: <Element 'COMMON' at 0x1015424b0>
373
374 In [9]: e[0][0].text
375 Out[9]: 'Bloodroot'
376
377 In [10]: e[0][4]
378 Out[10]: <Element 'PRICE' at 0x1015115a0>
379
380 In [11]: for t in e[0]: print t.tag
381 ....:
382 COMMON
383 BOTANICAL
384 ZONE
385 LIGHT
386 PRICE
387 AVAILABILITY
388
389 In [12]: for t in e[0]:
390 ....: if t.tag=="PRICE" : break
391 ....:
392
393 In [13]: t
394 Out[13]: <Element 'PRICE' at 0x1015115a0>
395
396 In [14]: t
397 Out[14]: <Element 'PRICE' at 0x1015115a0>
398
399 In [15]: t.text
400 Out[15]: '2.44'
401
402 In [16]: t.items
403 Out[16]: <built-in method items of Element object at 0x1015115a0>
404
405 In [17]: t.items()
406 Out[17]: [('CURRENCY', 'dollar')]
407
408 In [18]: dict(t.items())
409 Out[18]: {'CURRENCY': 'dollar'}
410
411 In [19]: ^D
412 Do you really want to exit ([y]/n)?
413 odd% ls
414 20140117114538 launch-wKcu4o
415 20140125123848 launchd-247.PVLsIw
416 com.microsoft.office.updater launchd-248.dtS7UW
417 histdata1.txt launchd-530.tilNwM
418 histdata2.txt launchd-974.9dhnbj
419 launch-8GJkjI xml_example.xml
420 launch-VZEk7L
421 odd%
Attached Files
To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.- [get | view] (2014-01-10 04:36:30, 6458.8 KB) [[attachment:Data_Types.pdf]]
- [get | view] (2014-01-06 03:11:54, 9437.1 KB) [[attachment:Ludtke_book_draft_2014_01.pdf]]
- [get | view] (2014-01-25 00:10:43, 9.8 KB) [[attachment:ctfplot.csv]]
- [get | view] (2014-02-10 14:05:26, 4530.9 KB) [[attachment:ecoli_k12.txt]]
- [get | view] (2014-01-10 19:13:16, 37.3 KB) [[attachment:extra_practice2.pdf]]
- [get | view] (2014-01-15 21:09:21, 42.3 KB) [[attachment:extra_practice3.pdf]]
- [get | view] (2014-01-21 05:22:12, 60.5 KB) [[attachment:extra_practice4.pdf]]
- [get | view] (2014-01-24 14:46:16, 22.9 KB) [[attachment:extra_practice5.pdf]]
- [get | view] (2014-01-27 17:39:51, 6.8 KB) [[attachment:histdata1.txt]]
- [get | view] (2014-01-27 17:40:02, 1.5 KB) [[attachment:histdata2.txt]]
- [get | view] (2014-01-10 14:34:53, 27.1 KB) [[attachment:homework_2.pdf]]
- [get | view] (2014-01-13 14:38:39, 21.2 KB) [[attachment:homework_3.pdf]]
- [get | view] (2014-01-17 14:11:51, 17.9 KB) [[attachment:homework_4.pdf]]
- [get | view] (2014-01-24 14:44:09, 19.9 KB) [[attachment:homework_5.pdf]]
- [get | view] (2014-01-27 17:00:25, 11.0 KB) [[attachment:homework_6.pdf]]
- [get | view] (2014-01-31 14:32:37, 31.6 KB) [[attachment:homework_7.pdf]]
- [get | view] (2014-02-03 14:22:20, 18.0 KB) [[attachment:homework_8.pdf]]
- [get | view] (2014-01-06 19:02:20, 144.3 KB) [[attachment:lecture_1.pdf]]
- [get | view] (2014-02-10 15:39:32, 1088.6 KB) [[attachment:lecture_10.pdf]]
- [get | view] (2014-02-14 15:03:46, 3235.0 KB) [[attachment:lecture_11.pdf]]
- [get | view] (2014-01-10 14:34:36, 146.5 KB) [[attachment:lecture_2.pdf]]
- [get | view] (2014-01-13 14:38:23, 210.8 KB) [[attachment:lecture_3.pdf]]
- [get | view] (2014-01-17 16:35:40, 356.8 KB) [[attachment:lecture_4.pdf]]
- [get | view] (2014-01-24 14:49:05, 146.6 KB) [[attachment:lecture_5.pdf]]
- [get | view] (2014-01-27 17:00:13, 407.7 KB) [[attachment:lecture_6.pdf]]
- [get | view] (2014-01-31 14:32:26, 164.2 KB) [[attachment:lecture_7.pdf]]
- [get | view] (2014-02-03 14:22:06, 80.6 KB) [[attachment:lecture_8.pdf]]
- [get | view] (2014-02-07 14:55:05, 1068.8 KB) [[attachment:lecture_9.pdf]]
- [get | view] (2014-01-25 00:12:29, 4.8 KB) [[attachment:singleplot.csv]]
- [get | view] (2014-01-06 18:59:47, 4.2 KB) [[attachment:terminal_1.txt]]
- [get | view] (2014-01-10 18:28:47, 7.5 KB) [[attachment:terminal_2.txt]]
- [get | view] (2014-01-31 18:19:38, 19.6 KB) [[attachment:terminal_7.txt]]
- [get | view] (2014-01-13 14:44:01, 1.0 KB) [[attachment:translate.py]]
You are not allowed to attach a file to this page.