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)

31st Dec 2018, 2:40 AM
Razf
Razf - avatar
2 Respuestas
+ 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.
31st Dec 2018, 3:59 AM
Шащи Ранжан
Шащи Ранжан - avatar
+ 1
Thanks!!!!
31st Dec 2018, 4:04 AM
Razf
Razf - avatar