ฟังก์ชัน str() ที่ใช้บ่อยที่สุดจากไลบรารี Python คืนค่า String representation ของออบเจ็กต์
>> no = 100
>>> str(no)
'100'
>>> L1 = [1,2,3,4]
>>> str(L1)
'[1, 2, 3, 4]'
>>> d = {'a': 1, 'b': 2, 'c': 3, 'd': 4}
>>> str(d)
"{'a': 1, 'b': 2, 'c': 3, 'd': 4}"
อย่างไรก็ตาม repr() คืนค่า Default และ Unambiguous representation ของออบเจ็กต์ ในขณะที่ str() ให้ Informal representation ที่อ่านง่ายแต่อาจไม่ Unambiguous เสมอไป
>> str(d)
"{'a': 1, 'b': 2, 'c': 3, 'd': 4}"
>>> repr(d)
"{'a': 1, 'b': 2, 'c': 3, 'd': 4}"
>>> repr(L1)
'[1, 2, 3, 4]'
>>> repr(no)
'100'