Skip to content

Instantly share code, notes, and snippets.

@Galina-Blokh
Last active January 10, 2021 20:18
Show Gist options
  • Save Galina-Blokh/57d286e0ea8307f4cd1d99bfcffcca6c to your computer and use it in GitHub Desktop.
Save Galina-Blokh/57d286e0ea8307f4cd1d99bfcffcca6c to your computer and use it in GitHub Desktop.
Using list comprehension to extract text data from a parsed response
ingredients_list = [item.text for item in recipe_ingredients_lines]
instructions_list = [paragraph.text for paragraph in recipe_instructions_lines]
json_file['Recipe'].append(ingredients_list)
json_file['INSTRUCTIONS'].append(instructions_list)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment