Tag Archives: email

Pyyaml tutorial introduction to pyyaml library and YML writing and reading

PyYAML

Source code: https://github.com/yaml/pyyaml

install

# pip command line installation
pip install PyYAML

# Download the source code for installation
python setup.py install

Import

import yaml

Read yaml file

def read_yaml(yml_file, mode='r', encoding='utf-8'):
    """ Read and convert the contents of yaml to Python objects

    :param yml_file:
    :param mode:
    :param encoding:
    :return:
    """
    # safe_load_all() Open multiple documents
    with open(yml_file, mode=mode, encoding=encoding) as y_file:
        # .load is a non-recommended and unsafe encoding method
        # content = yaml.load(y_file.read(), yaml.FullLoader)
        # .safe_load safe encoding method
        # If you don't trust the input stream, you should use:
        return yaml.safe_load(y_file)

Write yaml file

def write_yaml(yaml_file, data, mode='w', encoding='utf-8', is_flush=True):
    """ Converting Python objects to yaml

    :param yaml_file:
    :param data:
    :param mode:
    :param encoding:
    :param is_flush:
    :return:
    """
    with open(yaml_file, mode=mode, encoding=encoding) as y_file:
        # yaml.dump(data, stream=y_file)
        # allow_unicode Solve the problem of writing messy code
        yaml.safe_dump(data, stream=y_file, allow_unicode=True)
        if is_flush:
            y_file.flush()

IT Skill: How to Recall Email Message in Outlook 2007

In Go Lala Go, a hapless Helen accidentally sends a rather private email to everyone and gets fired, as everyone remembers. In real life, it’s not uncommon to accidentally send an email while it’s still being edited. How to do?Recall it immediately!

For the email Sent just now, find it in the Sent Items Folder. Open it. In the Ribbon screen that opens the email, select the following option:
Actions –> Other Actions –> Recall This Message…


Then, choose from the following dialog:


That will do.

It also is not always going to be successful. If it has already been browsed, it is going to be unsuccessful, so it is going to be fast.