import win32com.client as client
import pathlibInitialize the application
| """ | |
| A quick and dirty search within the contents of a docx file | |
| Author: Israel Dryer | |
| Modified: 2020-07-21 | |
| """ | |
| from zipfile import ZipFile | |
| # file path | |
| doc_path = 'senior_paper.docx' |
| """ | |
| A simple clock demonstration in PySimpleGUI | |
| >> YouTube Comments Response << | |
| """ | |
| import PySimpleGUI as sg | |
| from datetime import datetime | |
| layout = [[sg.Text(text=datetime.now().strftime('%I:%M:%S'), key='-CLOCK-')]] |
| import PySimpleGUI as sg | |
| # create output element | |
| output = sg.Output(size=(50, 15)) | |
| # button to initiate text printing | |
| button = sg.Button('Print long text', key='-BTN-') | |
| # set the layout | |
| layout = [[output], [button]] |
| """ | |
| Create a html formatted list from a python list | |
| """ | |
| # email template with curly braces to insert list | |
| email_template = ''' | |
| <p>Hello, here are the items that you ordered:<br> | |
| {} | |
| </p> | |
| ''' |
| import re | |
| import win32com.client as client | |
| # pattern for identifying email addresses | |
| pattern = re.compile(r'mailto:(\w+\.\[email protected])') | |
| outlook = client.Dispatch('Outlook.Application') | |
| namespace = outlook.GetNameSpace('MAPI') | |
| inbox = namespace.Folders['Inbox'] |
| """ | |
| Add members to an existing user distribution list in Python | |
| https://docs.microsoft.com/en-us/office/vba/api/outlook.mailitem.recipients | |
| https://docs.microsoft.com/en-us/office/vba/api/outlook.distlistitem.addmembers | |
| https://docs.microsoft.com/en-us/office/vba/api/outlook.oldefaultfolders | |
| """ | |
| import win32com.client as client | |
| # start an instance of outlook |
| Welcome to a series of tutorials on how to get the most out of Microsoft Outlook using python! | |
| <table> | |
| <tr> | |
| <td> | |
| <ul><b> | |
| <li><a href="https://github.com/israel-dryer/Outlook-Python-Tutorial/wiki">Home</a></li> | |
| <li><a href="https://github.com/israel-dryer/Outlook-Python-Tutorial/wiki/Getting-started">Getting started</a></li> | |
| <li><a href="https://github.com/israel-dryer/Outlook-Python-Tutorial/wiki/Plain-text-email">Plain text email</a></li> | |
| <li><a href="https://github.com/israel-dryer/Outlook-Python-Tutorial/wiki/HTML-formatted-email">HMTL formatted email</a></li> |
| import csv | |
| import requests | |
| from bs4 import BeautifulSoup | |
| stock = ['AMZN','AXP','AAPL','AXTA','BAC'] | |
| # create csv writer | |
| f = open("data_file.csv", "w", newline="", encoding="utf-8") | |
| writer = csv.writer(f) | |
| # add header to csv file |
| search_term = "product" | |
| for message in inbox.Items: | |
| if search_term in message.Subject: | |
| do_something() | |
| break # this will break out of the loop once the item is found |