RE newbie question

Steven D'Aprano steve+comp.lang.python at pearwood.info
Wed Apr 18 19:57:39 EDT 2018


On Wed, 18 Apr 2018 12:37:29 -0700, TUA wrote:

> My intention is to implement a max. length of 8 for an input string. The
> above works well in all other respects, but does allow for strings that
> are too long.

if len(input_string) > 8:
    raise ValueError('string is too long')



-- 
Steve




More information about the Python-list mailing list