Format the list of updated properties into a nicer sentence
This commit is contained in:
parent
d3feb6d03e
commit
940c626bbe
2 changed files with 13 additions and 2 deletions
11
posttext.py
Normal file
11
posttext.py
Normal file
|
@ -0,0 +1,11 @@
|
|||
from collections.abc import Sequence
|
||||
|
||||
|
||||
def list_to_sentence(list: Sequence[str]) -> str:
|
||||
match len(list):
|
||||
case 0:
|
||||
return str()
|
||||
case 1:
|
||||
return list[0]
|
||||
case _:
|
||||
return " and ".join((", ".join(list[0:-1]), list[-1]))
|
Loading…
Add table
Add a link
Reference in a new issue