Python Forum
reading a table which is of type string - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: reading a table which is of type string (/thread-38855.html)



reading a table which is of type string - saisankalpj - Dec-03-2022

      Date          Count      persons 
------------------- ---------- -------
2022/11/01-12:48:06     51   girls
2022/11/01-12:48:11    104   boys
2022/11/01-12:48:12    155   Total
 successful


     Date            Count     persons
------------------- ---------- -------
2022/11/02-12:48:06     30    girls
2022/11/02-12:48:11    10     boys
2022/11/02-12:48:12    40    Total
 successful
I have this above data extracted which is of type string.Now how do i read the tables data.Like suppose i want to read the Total(Which is 155 and 40 above) and store it in a variable


RE: reading a table which is of type string - Larz60+ - Dec-03-2022

please show tour code.


RE: reading a table which is of type string - saisankalpj - Dec-03-2022

ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect(host, username=username, password=password)
print("Connected")
stdin, stdout, stderr = ssh.exec_command(mycommands to extract data from host)

# This prints the table and i need to extract data from this
print(stdout.read().decode())
# print errors if there are any
err = stderr.read().decode()
if err:
    print(err)
ssh.close()