your_new_code="""
print(123)
return False
"""
...
updated_text = """
...
class MainApp(App):
def build(self):
main_layout = FloatLayout()
{some_text}
...
""".format(some_text=your_new_code)
def safe_search(tag, attrs):
x = div.find('span', attrs={'class' : 'subcategory-product-item__price_special'})
if x is not None:
return x.text()
else:
return ''
# your code above...
from email.mime.text import MIMEText
from email.mime.image import MIMEImage
from email.mime.multipart import MIMEMultipart
msg = MIMEMultipart()
for empl in results:
subject = "День рождения сотрудника"
body = "Поздавляем сотрудника " + empl[1] + " " + empl[2] + " с Днем Рождения!"
attach = results[3]
msg['Subject'] = subject
msg['From'] = 'pochta@gmail.com'
msg['To'] = 'pochta@mail.ru'
#
text = MIMEText(body.encode('utf-8').strip())
msg.attach(text)
image = MIMEImage(img_data, attach)
msg.attach(image)
smtpObj.sendmail(msg['From'],msg['To'],msg.as_string())
smtpObj.quit()