Category: Bollywood playback singers
Category: Indian female film singers
Category: Indian female pop singers
Category: Bollywood playback singers
Category: Year of birth missing (living people)Bishwa I
Bishwa I is an Indian politician and belongs to Bharatiya Janata Party. He was elected to the Lok Sabha the lower house of Indian Parliament from the Puri in the 2019 Indian general election as a member of the Bharatiya Janata Party.
References
Category:17th Lok Sabha members
Category:Lok Sabha members from Odisha
Category:Bharatiya Janata Party politicians from Odisha
Category:Living people
Category:Year of birth missing (living people)
Category:People from Puri districtQ:
Pythonic way to return a value from a generator
Is there a better way to do this in Python 3.6?
def find_next_element(element):
for key, value in element.items():
if isinstance(value, collections.Iterable):
for x in value:
if x == element:
yield key
else:
yield key
while True:
yield find_next_element(B)
print(next(find_next_element(A))) # 'a'
print(next(find_next_element(B))) # 'b'
A:
You can use chain to flatten the nested iterable
from itertools import chain
def find_next_element(element):
for key, value in element.items():
if isinstance(value, collections.Iterable):
for x in value:
if x == element:
yield key
else: ac619d1d87
Related links:
Yorumlar