When users access a web site page, their visits are logged by a web server and the logs are written to a text file. One row in the file corresponds to one HTTP request. There are a few commonly used log formats, however, we will use a very simple comma-delimited format with just a few fields:
<IP ADDRESS>,<QUOTED_PAGE_URL>,<TIMESTAMP>
An example: 195.19.255.253, "/download", 1725640644
This record can be represented in memory as a tuple with three elements: tuple[str,str,long]. Your task is to write two functions that encode and decode such tuples to/from strings:
When users access a web site page, their visits are logged by a web server and the logs are written to a text file. One row in the file corresponds to one HTTP request. There are a few commonly used log formats, however, we will use a very simple comma-delimited format with just a few fields:
An example:
195.19.255.253, "/download", 1725640644
This record can be represented in memory as a tuple with three elements: tuple[str,str,long]. Your task is to write two functions that encode and decode such tuples to/from strings:
encodeLogRecord(item: tuple[str,str,long]) -> str decodeLogRecord(textRow: str) -> tuple[str,str,long]
Please don't forget to write unit tests for these functions.