Files
edx-platform/common/lib/string_util.py
Victor Shnayder 7bdb5c23e1 Allow listing of users in cohorts and adding users
- still needs style, more features, but basic functionality works
2013-01-24 15:12:53 -05:00

12 lines
299 B
Python

import itertools
def split_by_comma_and_whitespace(s):
"""
Split a string both by on commas and whitespice.
"""
# Note: split() with no args removes empty strings from output
lists = [x.split() for x in s.split(',')]
# return all of them
return itertools.chain(*lists)