Python Forum

Full Version: reading a table which is of type string
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
      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
please show tour code.
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()