Python error TypeError: 'nonetype 'object is not iterable solution, typeerroriterable

Source: Internet
Author: User
Tags iterable

Python error TypeError: 'nonetype 'object is not iterable solution, typeerroriterable

Python error TypeError: 'nonetype 'object is not iterable Solution

TypeError: 'nonetype 'object is not iterable. This error message generally occurs when None is assigned to multiple values.

Def myprocess (): a = B if! = B: return True, value; flag, val = myprocess ()

In the Judgment statement, when the if condition is not met and there is no else statement, the function returns None by default.

If no return statement exists, Python returns None by default.

When you assign None to multiple values during the call, the following error occurs: TypeError: 'nonetype 'object is not iterable.

In this example, flag and val are both granted with None (because the if condition is not met, the default return of None.

Therefore, the function return value must take into account the coverage of the condition branch.

Thank you for reading this article. I hope it will help you. Thank you for your support for this site!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.