working with classes, inheritance, _str_ returns and a list

Frank Millman frank at chagford.com
Mon Jan 16 00:57:16 EST 2017


"Frank Millman"  wrote in message news:o5hlh4$1sb$1 at blaine.gmane.org...
>
> If you are saying -
>     for item in list:
>         print(item)
>
> you can say instead -
>   for item in list:
>         print(str(item))
>

This is not correct, sorry.

print(item) will automatically print the string representation of item, so 
it makes no difference.

The principle is still correct, though.

If you want to convert what you call the memory address of the item to the 
string representation, just wrap it in str(...)

Frank





More information about the Python-list mailing list