# README.md
https://github.com/TITIR1X/PyLogManagement
Designed to create variables with results that you can obtain by filtering the log that your terminal gives you by OS commands.
os_commands_regex()
Args:
os_command (str): OS command to execute
regex_function (str): 'findall', 'search', 'split', 'sub'
regex_parameters (str): parameters to execute. Example:
>>> import os_commands_regex
>>> ip_adress = os_commands_regex(os_command='ipconfig', regex_function='search', regex_parameters='IP Address.+: (\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3})')
>>> print(ip_adress)
['192.168.0.101']
# convert list to string:
>>> ip =''.join(ip_adress)
>>> print(ip)
192.168.0.101
Returns:
list: Returns the output of regex.
show_last_log():
"""_summary_
It is useful for copying special characters (which do not load in your text editor) and using them in regex parameters.
example:
>>> show_last_log()
INFO:root:
Configuraci¢n IP de Windows
Adaptador de LAN inal mbrica Wi-Fi:
Sufijo DNS espec¡fico para la conexi¢n. . : home
Direcci¢n IPv6 . . . . . . . . . . : 444:444:444:4444:4444:4444:4444:4444
Direcci¢n IPv6 . . . . . . . . . . : 333:333:333::3
Direcci¢n IPv6 . . . . . . . . . . : 333:333:333::3
V¡nculo: direcci¢n IPv6 local. . . : 222::222:222:222:222%2
Direcci¢n IPv4. . . . . . . . . . . . . . : 192.168.1.2
MÂ scara de subred . . . . . . . . . . . . : 111.111.111.111
Puerta de enlace predeterminada . . . . . : 1111:1111:d1::a11f:c11a
>>>>>> ip_adress = os_commands_regex(os_command='ipconfig', regex_function='search', regex_parameters='Direcci¢n IPv4.+: (\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3})')
>>> print(ip_adress)
['192.168.1.2']
"""
regex101.com
Tutorial rápido REGEX en español: https://www.youtube.com/watch?v=Mc2j8Q-MHB4&ab_channel=ThePyCoach -> credits: The PyCoach
Raw data
{
"_id": null,
"home_page": "https://github.com/TITIR1X/PyLogManagement",
"name": "PyLogManagement",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "Python,Console,Log,Management,RegEx,Variable,String,Output of OS commands to str or list",
"author": "Santiago Benavidez (TITIR1X)",
"author_email": "SantiagoBenavidez@pythondeveloper.com",
"download_url": "",
"platform": null,
"description": "# README.md\r\n\r\nhttps://github.com/TITIR1X/PyLogManagement\r\n\r\nDesigned to create variables with results that you can obtain by filtering the log that your terminal gives you by OS commands.\r\n\r\nos_commands_regex()\r\nArgs:\r\n os_command (str): OS command to execute\r\n regex_function (str): 'findall', 'search', 'split', 'sub'\r\n regex_parameters (str): parameters to execute. Example:\r\n >>> import os_commands_regex\r\n >>> ip_adress = os_commands_regex(os_command='ipconfig', regex_function='search', regex_parameters='IP Address.+: (\\d{1,3}.\\d{1,3}.\\d{1,3}.\\d{1,3})')\r\n >>> print(ip_adress)\r\n ['192.168.0.101']\r\n\r\n # convert list to string:\r\n >>> ip =''.join(ip_adress)\r\n >>> print(ip)\r\n 192.168.0.101\r\n\r\nReturns:\r\n list: Returns the output of regex.\r\n\r\nshow_last_log():\r\n \"\"\"_summary_\r\n It is useful for copying special characters (which do not load in your text editor) and using them in regex parameters.\r\n example:\r\n >>> show_last_log()\r\n INFO:root:\r\n Configuraci\u00c2\u00a2n IP de Windows\r\n\r\n Adaptador de LAN inal\u00c2\u00a0mbrica Wi-Fi:\r\n\r\n Sufijo DNS espec\u00c2\u00a1fico para la conexi\u00c2\u00a2n. . : home\r\n Direcci\u00c2\u00a2n IPv6 . . . . . . . . . . : 444:444:444:4444:4444:4444:4444:4444\r\n Direcci\u00c2\u00a2n IPv6 . . . . . . . . . . : 333:333:333::3\r\n Direcci\u00c2\u00a2n IPv6 . . . . . . . . . . : 333:333:333::3\r\n V\u00c2\u00a1nculo: direcci\u00c2\u00a2n IPv6 local. . . : 222::222:222:222:222%2\r\n Direcci\u00c2\u00a2n IPv4. . . . . . . . . . . . . . : 192.168.1.2\r\n M\u00c2\u00a0scara de subred . . . . . . . . . . . . : 111.111.111.111\r\n Puerta de enlace predeterminada . . . . . : 1111:1111:d1::a11f:c11a\r\n \r\n\r\n >>>>>> ip_adress = os_commands_regex(os_command='ipconfig', regex_function='search', regex_parameters='Direcci\u00c2\u00a2n IPv4.+: (\\d{1,3}.\\d{1,3}.\\d{1,3}.\\d{1,3})')\r\n >>> print(ip_adress)\r\n ['192.168.1.2']\r\n \"\"\"\r\n\r\nregex101.com\r\nTutorial r\u00c3\u00a1pido REGEX en espa\u00c3\u00b1ol: https://www.youtube.com/watch?v=Mc2j8Q-MHB4&ab_channel=ThePyCoach -> credits: The PyCoach\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Output of OS commands to str or list",
"version": "0.0.1",
"split_keywords": [
"python",
"console",
"log",
"management",
"regex",
"variable",
"string",
"output of os commands to str or list"
],
"urls": [],
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "TITIR1X",
"github_project": "PyLogManagement",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "pylogmanagement"
}