Python Program Using String Functions In R