Replace substrings of a string using a dictionary.
(s, d)
| 10 | from . import xmlreader |
| 11 | |
| 12 | def __dict_replace(s, d): |
| 13 | """Replace substrings of a string using a dictionary.""" |
| 14 | for key, value in d.items(): |
| 15 | s = s.replace(key, value) |
| 16 | return s |
| 17 | |
| 18 | def escape(data, entities={}): |
| 19 | """Escape &, <, and > in a string of data. |