What is rstrip() in python?
rosuav at gmail.com
Sun Nov 9 12:28:29 CET 2014
On Sun, Nov 9, 2014 at 10:11 PM, <satishmlmlml at gmail.com> wrote:
> What is rstrip() in python?
> What does it do in the following piece of code?
> import sqlite3
> conn = sqlite3.connect('dbase1')
> curs = conn.cursor()
> file = open('data.txt')
> rows = [line.rstrip().split(',') for line in file]
Do you know what type of object 'line' is here? Do you know what you
get when you iterate over a file?
Get an object of that type in the interactive interpreter, maybe like this:
file = open('data.txt')
line = next(file)
Then you can find out about its methods:
That should tell you what you want to know.
More information about the Python-list