(str, d, defaultsep='')
| 785 | |
| 786 | |
| 787 | def replace(str, d, defaultsep=''): |
| 788 | if isinstance(d, list): |
| 789 | return [replace(str, _m, defaultsep) for _m in d] |
| 790 | if isinstance(str, list): |
| 791 | return [replace(_m, d, defaultsep) for _m in str] |
| 792 | for k in 2 * list(d.keys()): |
| 793 | if k == 'separatorsfor': |
| 794 | continue |
| 795 | if 'separatorsfor' in d and k in d['separatorsfor']: |
| 796 | sep = d['separatorsfor'][k] |
| 797 | else: |
| 798 | sep = defaultsep |
| 799 | if isinstance(d[k], list): |
| 800 | str = str.replace('#%s#' % (k), sep.join(flatlist(d[k]))) |
| 801 | else: |
| 802 | str = str.replace('#%s#' % (k), d[k]) |
| 803 | return str |
| 804 | |
| 805 | |
| 806 | def dictappend(rd, ar): |
no test coverage detected