On Sun, Nov 9, 2014 at 10:11 PM, <[email protected]> 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:
help(line.rstrip)
That should tell you what you want to know.
ChrisA
--
https://mail.python.org/mailman/listinfo/python-list