Does Python's time.time() return the local or UTC timestamp?

The time.time() function in Python returns the current timestamp in seconds since the epoch (January 1, 1970) in the local timezone. Here is an example of using the time.time() function to get the current timestamp:

import time

current_timestamp = time.time()
print(current_timestamp)

Watch a course Python - The Practical Guide

If you want the UTC timestamp, you can use datetime.datetime.utcnow() from python's datetime library. Here is an example of using datetime.datetime.utcnow() to get the current UTC timestamp:

from datetime import datetime

current_utc_time = datetime.utcnow()
print(current_utc_time)

Note that the above example will give you a datetime object, which you can format as per your need.