I have a file named phone.py which give me output as(in terminal):
+911234567890
+910123321423
There can be more number of outputs.
Another file named email.py which produces(in terminal):
[email protected]
[email protected]
or more.
And I have a JSON File whose structure is as follows:
{"One":"Some data",
"two":"Some more data",
"three":"Even more data"}
There can be a many more sections like this.
Now I want the capture the terminal output and also load the existing JSON and finally, have an output as follows (as a JSON file):
{Phone:"+911234567890,+910123321423", "Email":"[email protected],[email protected]","Sections":"{"One":"Some data",
"two":"Some more data",
"three":Even more data"}"}
I tried to capture the output using subprocess module in python and now it is stored in a variable
subprocess.run(['python','email.py','filename.txt'], stdout= subprocess.PIPE)
output:
CompletedProcess(args=['python', 'email_txt.py', 'upload/filename.txt'], returncode=0, stdout=b'[email protected]\[email protected]\n')
I have a string in which data is stored not I want the desired output through these components. What can I do or refer to tackle this problem ?