Created
November 18, 2021 10:51
-
-
Save tabebqena/9865bd90b9deae2af51c522d15ed4234 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import datetime | |
| fake_durations = [] # list of durations in seconds | |
| for x in range(0, 1000): | |
| fake_durations.append(1000) | |
| # it is = 1 milion | |
| # 1 milion seconds is more than 11 days. | |
| def plylst(): | |
| duration = [] | |
| dict1 = {} | |
| total_in_seconds = 0 | |
| for d in fake_durations: | |
| # to simulate duration.append(video.length) | |
| duration.append(d) | |
| # durations now contain 1000 elemnt , each of them = 1000 | |
| # NB:. I changes the indentation here | |
| total_in_seconds = sum(duration) | |
| print(total_in_seconds) # it equals 1 milion , So it is correct till here | |
| # str(datetime.timedelta(seconds=sum(duration))) | |
| your_value = datetime.timedelta(seconds=sum(duration)) | |
| print(your_value) # correct also | |
| with open("سلاسل السرد.txt", "a", encoding="utf-8") as f: | |
| for key, value in dict1.items(): | |
| print(f"{key}: {value}", file=f) | |
| print(your_value, file=f) # correct also | |
| plylst() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment