I want to make a text using python generator
I'm a beginner and have started learning python recently , I have searched the web but didn't find anything useful
def make_text(n):
b = ["hello"]
yield n+b
n = ['how are you', 'what is your name']
for x in range(2):
title = driver.find_element_by_xpath('//*[@id="title"]')
title.send_keys(make_text(n))
I want to get :
hello how are you
hello what's your name?
but i get this error :
object of type 'generator' has no len()
thanks in advance
return n+binstead ofyield n+b?make_text()title.send_keyschecks thelenof theargumentpassed ? If that is the case, then you can't pass the generator to thetitle.send_keys:). Anyway, why are you usinggenerators for this ?