Commit b2d610f33b4b89f4ce2b9303827b56a28bccbbb7
1 parent
eb74569d
Remove unnecessary import.
Showing
1 changed file
with
5 additions
and
2 deletions
examples/python/xml_howto.py
| ... | ... | @@ -27,7 +27,6 @@ |
| 27 | 27 | # |
| 28 | 28 | # ========================================================================== |
| 29 | 29 | from gammalib import * |
| 30 | -from math import * | |
| 31 | 30 | |
| 32 | 31 | |
| 33 | 32 | # =================== # |
| ... | ... | @@ -169,10 +168,14 @@ def manipulate_xml(xml): |
| 169 | 168 | # 'info'. This illustrates the logic of the attribute() method: if the |
| 170 | 169 | # attribute name does not exist the attribute will be added, otherwise |
| 171 | 170 | # it will be modified. |
| 171 | + # | |
| 172 | + # Finally, the 'case' attribute is removed using the remove_attribute() | |
| 173 | + # method. | |
| 172 | 174 | last.name('new3') |
| 173 | 175 | last.attribute('type', 'none') |
| 174 | 176 | last.attribute('case', 'mixed') |
| 175 | 177 | last.attribute('type', 'info') |
| 178 | + last.remove_attribute('case') | |
| 176 | 179 | |
| 177 | 180 | # Now we make again a text replacement, but instead of chaning the |
| 178 | 181 | # text of the last element we change the text of the last element with |
| ... | ... | @@ -229,7 +232,7 @@ def show_xml(xml): |
| 229 | 232 | # ======================== # |
| 230 | 233 | if __name__ == '__main__': |
| 231 | 234 | """ |
| 232 | - Simulate photons. | |
| 235 | + Example script for creating and handling XML documents. | |
| 233 | 236 | """ |
| 234 | 237 | # Dump header |
| 235 | 238 | print("") | ... | ... |