lightcli.py
def list_input(prompt='List input - enter each item on a seperate line\n' + \
        'Enter EOF on a blank line to end ' + \
        '(ctrl-D in *nix, ctrl-Z in windows)',
        maxitems=None, maxlength=None):
    """Get a list of strings as input"""
    
    lines = []
    print(prompt)
    inum = 1

    try:

        while True:
        
            if maxitems:
            
                if inum > maxitems:
                    break
                else:
                    if maxlength:
                        lines.append(string_input('')[:maxlength])
                    else:
                        lines.append(string_input(''))
                    inum += 1
            
            else:
                if maxlength:
                    lines.append(string_input('')[:maxlength])
                else:
                    lines.append(string_input(''))

    except EOFError:
        pass
    finally:
        return lines
def list_input(prompt='List input - enter each item on a seperate line\n' + \
        'Enter EOF on a blank line to end ' + \
        '(ctrl-D in *nix, ctrl-Z in windows)',
        maxitems=None, maxlength=None):
    lines = []
    print(prompt)
    inum = 1

    try:

        while True:
        
            if maxitems:
            
                if inum > maxitems:
                    break
                else:
                    if maxlength:
                        lines.append(string_input('')[:maxlength])
                    else:
                        lines.append(string_input(''))
                    inum += 1
            
            else:
                if maxlength:
                    lines.append(string_input('')[:maxlength])
                else:
                    lines.append(string_input(''))

    except EOFError:
        pass
    finally:
        return lines
def list_input ( prompt = 'List input - enter each item on a seperate line\n' + 'Enter EOF on a blank line to end ' + '(ctrl-D in *nix, ctrl-Z in windows)' , maxitems = None , maxlength = None ) : lines = [ ] print ( prompt ) inum = 1 try : while True : if maxitems : if inum > maxitems : break else : if maxlength : lines . append ( string_input ( '' ) [ : maxlength ] ) else : lines . append ( string_input ( '' ) ) inum += 1 else : if maxlength : lines . append ( string_input ( '' ) [ : maxlength ] ) else : lines . append ( string_input ( '' ) ) except EOFError : pass finally : return lines
Get a list of strings as input
Get a list of strings as input