I'm trying to do a ternary like operator for python to check if my dictionary value exist then use it or else leave it blank, for example in the code below I want to get the value of creator and assignee, if the value doesn't exist I want it to be '' if theres a way to use ternary operator in python?
Here's my code :
        in_progress_response = requests.request("GET", url, headers=headers, auth=auth).json()
        issue_list = []
        for issue in in_progress_response['issues'] :
            # return HttpResponse( json.dumps( issue['fields']['creator']['displayName'] ) )
            issue_list.append(
                            {
                                "id": issue['id'],
                                "key": issue['key'],
                                # DOESN'T WORK
                                "creator": issue['fields']['creator']['displayName'] ? '',
                                "is_creator_active": issue['fields']['creator']['active'] ? '',
                                "assignee": issue['fields']['assignee']['displayName'] ? '', 
                                "is_assignee_active": issue['fields']['assignee']['active'] ? '',
                                "updated": issue['fields']['updated'],
                            }
            )
         return issue_list
 
     
     
    