BaşlayınÜcretsiz Başlayın

Unix timestamps

Datetimes are sometimes stored as Unix timestamps: the number of seconds since January 1, 1970. This is especially common with computer infrastructure, like the log files that websites keep when they get visitors.

Bu egzersiz

Working with Dates and Times in Python

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • Complete the for loop to loop over timestamps.
  • Complete the code to turn each timestamp ts into a datetime.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Import datetime
from datetime import datetime

# Starting timestamps
timestamps = [1514665153, 1514664543]

# Datetime objects
dts = []

# Loop
for ts in ____:
  dts.append(datetime.____(____))
  
# Print results
print(dts)
Kodu Düzenle ve Çalıştır