Implement a stack class in Python
Thanks for sharing your code,

instead of using size, you should implement __len__, this way you can use len(my_stack).

def __len__(self):
    return len(self.item)


I think a method that prints an element from a collection is a bit unusual. What I would expect is a method called peek that returns the top element but doesn't remove it. By just printing it you're limiting its use to console only applications, and the only way to retrieve the element is to remove it!

You should consider adding an error message to go with your IndexError, and maybe reconsider the exception type, an IndexError sounds like you're accessing an index, but you're not maybe a custom StackEmpty exception would be more suitable.

I think self.item should be self.items (plural) as it will be representing zero or more items.

Bonus Stuff

you could implement the __iter__ method. This would allow the caller to do something like

for element in my_stack:
    do_stuff()


You code is also missing docstrings, you could optionally add those to document your code.

You could implement the __str__ method to provide a nice string representation so you can simply say

print my_stack

Hopefully you found this helpful, keep it up!