#! /usr/bin/python3
# ===================================================================
# read a string of parameters separated by commas and spaces.
# convert all commas into spaces, then split on space.
#
# This code is good for simple parameters. It does not correctly
# process parameters containing space or empty parameters.
# For example:    a, b,, d, param meter
# ===================================================================
def replace_commas_and_split(s):
    lst = s.replace(',',' ').split()
    return lst
# -------------------------------------------------------------------
# ---- main
# -------------------------------------------------------------------
if __name__ == '__main__':
    import user_interface as ui
    if not ui.running_python3:
        print()
        print('Must run Python3 - exit program')
        print()
        sys.exit()
    ui.clear_screen()
    while True:
        print()
        s = ui.get_user_input('Enter test string: ')
        if not s:
            break
        lst = replace_commas_and_split(s)
        print()
        print(f'Param list len = {len(lst)}')
        for x in lst:
            print(f'"{x}"')