How to use 'python multiple split chars' in Python

Every line of 'python multiple split chars' 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.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
113def split(string, char):
114 """ Split a string with a char and return always two parts"""
115 string_list = string.split(char)
116 if len(string_list) == 1:
117 return None, None
118 return char.join(string_list[:-1]), string_list[-1]
Important

Use secure code every time

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


Related snippets