[Python-ideas] The non-obvious nature of str.join (was Re: sum(...) limitation)

Alexander Heger python at 2sn.net
Tue Aug 12 01:16:24 CEST 2014


> - you have input consisting of numbers with ',' as the decimal separator
> (the default in German-speaking countries), but downstream software expects
> '.'
>
> ,i.e., they can all be solved with the general pattern:
>
> s = new_sep.join(s.split(old_sep))

In [1]: 'a,b'.replace(',','.')
Out[1]: 'a.b'


More information about the Python-ideas mailing list