Python "TypeError: ' Nonetype ' object is not iterable" error parsing

Source: Internet
Author: User
Tags iterable

Respect original blogger, original link: 9953225

Resolution

Generally, the function returns a value of None and is assigned to multiple variables.

Example look at the following:

C=0
def test (): if c = = 1: a = b = 1 return A, BA, B = Test ()

When you call with a, B = Test (), you get an error: TypeError: ' Nonetype ' object is not iterable

In a Python judgment statement, when the IF condition is not satisfied and there is no else, it returns none, even if no return will default to None

In this case, a, B has given the none value, the above error occurs.

So the function return value must take into account the coverage of the conditional branch.

I am a student who is reading, if there are errors, please the Great God generously pointed out, thank you!

Python "TypeError: ' Nonetype ' object is not iterable" error parsing

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.