Home > Mobile >  Python humanfriendly stop printing "and"
Python humanfriendly stop printing "and"

Time:04-29

Pythons humanfriendly library prints in the format "1 day, 6 hours and 19 minutes", is there a way to stop it from printing the "and" word?

So I want it to print "1 day, 6 hours, 19 minutes"

CodePudding user response:

From the documentation, you can't do that natively with the library.

You could simply replace the "and" yourself though.

>>> "1 day, 6 hours and 19 minutes".replace(" and ", ", ")
'1 day, 6 hours, 19 minutes'
  • Related