import psycopg2
connection = psycopg2.connect(database='db', user='user')
cur = connection.cursor()
cur.mogrify('CREATE USER %s PASSWORD %s', (AsIs('someuser'), AsIs(
    'somepassword')))
"""CREATE USER someuser PASSWORD somepassword"""
python adds "E" to string