dataset = [
["route1","car1","alex"],
["route1","car1","boris"],
["route2","car1","alex"],
["route2","car1","boris"],
["route1","car1","john"],
["route3","car2","alex"],
["route1","car2","alex"],
["route1","car3","alex"],
["route1","car2","alex"],
["route1","car2","alex"],
["route3","car1","alex"],
]
outdataset = {}
for route,car,driver in dataset:
key = (route,car)
_d = outdataset.get(key,set())
_d.add(driver)
outdataset[key] = _d
for route,car in outdataset.keys():
print(route,car,", ".join(outdataset[(route,car)]))
route1 car1 john, alex, boris
route2 car1 alex, boris
route3 car2 alex
route1 car2 alex
route1 car3 alex
route3 car1 alex
python sorted
- https://tproger.ru/translations/python-sorting/filename=“myfile.doc”
Args:
chat_id (:obj:`int` | :obj:`str`): Unique identifier for the target chat or username
of the target channel (in the format @channelusername).
document (:obj:`str` | `filelike object` | :class:`telegram.Document`): File to send.
Pass a file_id as String to send a file that exists on the Telegram servers
(recommended), pass an HTTP URL as a String for Telegram to get a file from the
Internet, or upload a new one using multipart/form-data. Lastly you can pass
an existing :class:`telegram.Document` object to send.
filename (:obj:`str`, optional): File name that shows in telegram message (it is useful
when you send file generated by temp module, for example). Undocumented.
caption (:obj:`str`, optional): Document caption (may also be used when resending
documents by file_id), 0-1024 characters.
parse_mode (:obj:`str`, optional): Send Markdown or HTML, if you want Telegram apps to
show bold, italic, fixed-width text or inline URLs in the media caption. See the
constants in :class:`telegram.ParseMode` for the available modes.
disable_notification (:obj:`bool`, optional): Sends the message silently. Users will
receive a notification with no sound.
reply_to_message_id (:obj:`int`, optional): If the message is a reply, ID of the
original message.
reply_markup (:class:`telegram.ReplyMarkup`, optional): Additional interface options. A
JSON-serialized object for an inline keyboard, custom reply keyboard, instructions
to remove reply keyboard or to force a reply from the user.
thumb (`filelike object`, optional): Thumbnail of the
file sent. The thumbnail should be in JPEG format and less than 200 kB in size.
A thumbnail's width and height should not exceed 90. Ignored if the file is not
is passed as a string or file_id.
timeout (:obj:`int` | :obj:`float`, optional): Send file timeout (default: 20 seconds).
**kwargs (:obj:`dict`): Arbitrary keyword arguments.
Returns:
:class:`telegram.Message`: On success, the sent Message is returned