Python: Cast time module as string

python, time

Solution

You imported just the `time` module and turned that into a string; you need to call the `time.time()` function:

timeStamp = "TIME-" + str(time.time())

Problem

I have a string in a piece of python code which I want to add a time stamp too. However, when I try to cast the timestamp to a string I get the data type, rather than a string representation of the timestamp. The code looks like this, ``` timeStamp = "TIME-" + str(time) print timeStamp >>> Time-<module 'time' (built-in)> ``` How do you cast a timestamp as a string to allow it to be concatenated with another string?

Original source