I have the following python code:
open_file=open("path to a file",'r')
from prettytable import PrettyTable
import csv
table1=PrettyTable(["COLUMN1","COLUMN2","COLUMN3"])
for lines in open_file:
temp=(lines.split("%")[1])
get_severity_no=temp.split(":")[0]
Description=temp.split(":")[1]
if "3" in get_severity_no:
GET_DATE=lines.split(";")[0]
table1.add_row([GET_DATE,get_severity_no,Description])
print(table1)
This code will simply print the desired output in a table format. Sample output shown below:
Now I'm calling this script from php. Here is the php code.
<?php
$mystring = system('python get_files.py');
echo $mystring
?>
Now this is the output that I'm getting.
All the formatting has been lost. Could u please let me know what I should do to make this proper? I'm very new to php but comfortable with python.
