I’ve got a DB chock full o’ phone numbers as strings, they’re all formatted like 1112223333, I’d like to display it as 111-222-3333 in my django template
I know I can do
n = contacts.objects.get(name=name)
n.phone = n.phone[:3] + '-' + n.phone[3:6] + '-' + n.phone[6:]
but is there a better / more pythonic way?
Just one other solution:
or