0
Python Doubt
I was doing some experiements while writing a code. To my surprise I found something strange result. I know the code is wrong but it was just my curiosity to experiement it. https://code.sololearn.com/cuMBIxY38QvN/?ref=app
3 ответов
+ 2
Your code is not wrong.
In Python functions are objects, so you are able to print them.
So you see the name and the memory address of isalnum()
For more details you can read this article: https://www.journaldev.com/22460/python-str-repr-functions
+ 1
If you are looking for the value True or False don't forget to add ( ) to your method.
print(name.isalnum()) will return True
0
What's the problem ? It's a function object, executed with parentheses
name="kartik"
print(name.isalnum)
help(name.isalnum)
print("\n".join([x for x in dir(name)]))