def rst2md(text):
 pandoc = subprocess.Popen(['pandoc', '--from=rst', '--to=markdown', '--no-wrap'], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
 (stdout, _) = pandoc.communicate(text.encode('utf-8'))
 md = stdout.decode('utf-8').strip()
 return re.sub('^-   ', '- ', md, flags=re.M)

def rst2md ( text ) : pandoc = subprocess . Popen ( [ 'pandoc' , '--from=rst' , '--to=markdown' , '--no-wrap' ] , stdin = subprocess . PIPE , stdout = subprocess . PIPE , stderr = subprocess . PIPE ) ( stdout , _ ) = pandoc . communicate ( text . encode ( 'utf-8' ) ) md = stdout . decode ( 'utf-8' ) . strip ( ) return re . sub ( '^-   ' , '- ' , md , flags = re . M )
use pandoc to convert text from rest to markdown .