0
Why the output is "None" ?
im trying to make an email verifier and i got this problem, the output of the next code is None, i would expect it to be ["deimoz", "@", 1] (i put the number one just to make it simple, in the original code is different, but the result is the same and im really stuck here, please help ....) email = "deimoz@gmail.com" email_components = email.partition("@") email_components = list(email_components[:2]).append(1) print(email_components)
2 ответов
+ 2
It's bcz append function returns None.
In your code, basically, email_components= some_list.append(1)
some_list.append() return None which is being stored in the email_components.
Instead write email_components.append(1) in a new line.
+ 1
Thanks!!!!