I have the below python file "source.py", which is having dictionary(default_args) in it. I would like to extract only default_args dictionary from another python file "destination.py"
source.py:
from datetime import timedelta
import os
default_args = {
'owner': 'kumar',
'team': 'data_engineering',
'start_date': timezone.datetime(2018, 4, 9, 0, 0, 0, tzinfo=LOCAL_TZ),
'provide_context': True,
'environment': ENV,
'email': 'venkatsiva789@gmail.com',
'email_on_failure': True,
}
destination.py:
text = open("source.py").read()
print(text)
I want to extract only the below code snippet.
default_args = {
'owner': 'kumar',
'team': 'data_engineering',
'start_date': timezone.datetime(2018, 4, 9, 0, 0, 0, tzinfo=LOCAL_TZ),
'provide_context': True,
'environment': ENV,
'email': 'venkatsiva789@gmail.com',
'email_on_failure': True,
}
Please help to extract the above code snippet or let me know is there any built in module to extract specific dictionary.