Python Forum
Converting a remainder to int to str
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Converting a remainder to int to str
#5
what I actually need is to have all the "hours" added without converting it to days.

if I ran this script the outcome is "18:53:27" but it should be "138:53:27"

sec = 500007
sec_value = int(sec % (24 * 3600))
hour_value = str(int(sec_value // 3600))
sec_value %= (int(3600))
min = str(int(sec_value // 60))
sec_value %= 60
print(hour_value+":"+min+":"+str(sec_value))
Thank you!
Reply


Messages In This Thread
Converting a remainder to int to str - by tester_V - Oct-27-2020, 07:13 PM
RE: Converting a remainder to int to str - by tester_V - Oct-27-2020, 11:33 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Could not parse the remainder: '=' from '=' Saurabh 3 14,513 Feb-20-2019, 11:18 AM
Last Post: buran
  remainder operator % noweare 3 2,836 Feb-14-2019, 01:50 AM
Last Post: noweare

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020