Python Using Yield From In A Function
i have a list like: list=['2,130.00','2,140.00','2,150.00','2,160.00'] i would like to use a function like def f(iterable): yield from iterable and applying float(item.repla
Solution 1:
yield from
is a pass-through; you are delegating to the iterable. Either wrap the iterable in a generator expression to transform elements, or don't use yield from
but an explicit loop:
def f(iterable):
yieldfrom (i.replace(',', '') for i in iterable)
or
def f(iterable):
for item in iterable:
yield item.replace(',', '')
Post a Comment for "Python Using Yield From In A Function"