Every line of 'python replace space with underscore' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.
23 def underscore(word): 24 word = re.sub(r"([A-Z]+)([A-Z][a-z])", r'\1_\2', word) 25 word = re.sub(r"([a-z\d])([A-Z])", r'\1_\2', word) 26 word = word.replace("-", "_") 27 28 return word.lower()
Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code
20 def underscore(name): 21 return re.sub('([A-Z]+)', r'_\1', name).strip('_').lower()
22 def underscore(name): 23 return re.sub(r' ', r'_', name).lower()
14 def underscore(value): 15 ''' Convert dots to underscore in a string ''' 16 return value.replace('.', '_')
241 def underscore(string): 242 sanitzed_string = _string_sanity_check(string) 243 replaced = re.sub(r"([A-Z]+)([A-Z][a-z])", r'\1_\2', sanitzed_string) 244 replaced = re.sub(r"([a-z\d])([A-Z])", r'\1_\2', replaced) 245 return replaced.replace("-", "_").lower()
71 def underscore_style(c): 72 return c.replace(" ","_").lower()
32 def underscore(title): 33 return re.sub(r"(?<=[a-z])(?=[A-Z])", u"_", title).lower()
148 @staticmethod 149 @not_keyword 150 def _underscore(str): 151 return re.sub(r"\s+", "_", str)
24 def remove_space(s): 25 return re.sub(r'\n|\r|\s', '', s)
37 def withoutLeadingUnderscore( thisName ): 38 if thisName and thisName.startswith("_"): 39 return thisName[1:] 40 else: 41 return thisName