I'm loading a JSON and I'm printing string formatting.
fmt = (u"{id:<4} {title:<28} {timestamp:<23} {description:<23}"
u" {link}")
and to print:
for item in items
print(fmt.format(**item))
This works fine. But the problem here is that I'm printing a unix timestamp.
Now I've written a function (convert_unix_timestamp
)which converts the unix timestamp to a readable timestamp.
But how can I use this function and also use my string formatting?
I was thinking about something as below but I don't know how to make this work
fmt = (u"{id:<4} {title:<28} {self.convert_unix_timestamp(timestamp):<23} {description:<23}"
u" {link}")
Can someone tell me how I can use a function inside this above?