[Beginner] Spliting input

Frank Millman frank at chagford.com
Thu Jun 25 08:28:06 EDT 2020


On 2020-06-25 2:13 PM, Bischoop wrote:
> On 2020-06-25, Andrew Bell <andrew.bell.ia at gmail.com> wrote:
>> Without knowing the problem you're having, it's hard to answer.
>> This seems generally correct.
>>
>>
> Error track:
> Traceback (most recent call last):
>    File "splitting.py", line 1, in <module>
>        numb1,numb2=input("enter 1st and 2nd no ").split()
>        ValueError: not enough values to unpack (expected 2, got 1)
> 

Without arguments, split() splits on whitespace.

If you entered 2 numbers separated by a comma, but no spaces, there is 
no split.

Maybe you meant split(',') which will split on a comma.

Frank Millman



More information about the Python-list mailing list