What is rstrip() in python?

Steven D'Aprano steve+comp.lang.python at pearwood.info
Sun Nov 9 13:57:22 CET 2014

satishmlmlml at gmail.com wrote:

> What is rstrip() in python?

Have you read the Fine Manual?

Did you try googling first?


> What does it do in the following piece of code?

It removes trailing whitespace.

> import sqlite3
> conn = sqlite3.connect('dbase1')
> curs = conn.cursor()
> file = open('data.txt')
> rows = [line.rstrip().split(',') for line in file]


More information about the Python-list mailing list