def readme ( ) : try : import pypandoc readme_content = pypandoc . convert ( 'README.md' , 'rst' ) except ( IOError , ImportError ) : print ( "Warning: no pypandoc module found." ) try : readme_content = open ( 'README.md' ) . read ( ) except IOError : readme_content = '' return readme_content
python read doc and rtf
Try converting the README to an RST document . Return it as is on failure .
def readme():
    """Try converting the README to an RST document. Return it as is on failure."""
    try:
        import pypandoc
        readme_content = pypandoc.convert('README.md', 'rst')
    except(IOError, ImportError):
        print("Warning: no pypandoc module found.")
        try:
            readme_content = open('README.md').read()
        except IOError:
            readme_content = ''
    return readme_content