Jun-18-2019, 11:08 PM
i need to replace a run of white space characters by a string, which is usually a single character (but not always). for example: "foo \t bar" -> "foo_bar". is this a pythonic way to do that?
replace_with = "_" # or this gets set some other way convert_this = "foo \t bar" # or this gets set some other way result = replace_with.join(convert_this.split())or is there a better one like a not-known-to-me way to specify a run of white space in str.replace()?