Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.009 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'skip:[ 20': 0.04; 'here?': 0.09; 'iterate': 0.09; 'rows': 0.09; 'cc:addr:python-list': 0.11; 'code?': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'interpreter,': 0.16; 'subject:python': 0.16; 'wrote:': 0.18; 'import': 0.22; 'python?': 0.22; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'this:': 0.26; 'header:In-Reply-To:1': 0.27; 'message-id:@mail.gmail.com': 0.30; 'piece': 0.31; 'file': 0.32; 'know.': 0.32; 'maybe': 0.34; 'received:google.com': 0.35; 'subject:?': 0.36; 'should': 0.36; 'nov': 0.38; 'pm,': 0.38; 'does': 0.39; 'tell': 0.60; '10:11': 0.84; 'curs': 0.84; 'to:none': 0.92 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=Rmz98R+I6iO8ZGz/9LqsxGkKVkFsvNTHQGTClY51VXo=; b=LMCawpqYL226ppJUNguhTKabX5Onbg8amkOZA+PhHgx3bljw2X1Fdv0N/WbnLgRQVt fmO0OyIdFSlxnqZ101Ilx8aQ5Sye6nfc+bb/1m1ws7f0TLPpjDmNF1+1E4KN28ghJIha CnLFYG7rq6x2UdLi9YDcpPqJc+f8cYCyzLrZO0dDGosDrLIcHbMFLYiIDsgxI/WZXA27 O/kNO9Amwkh2CnGwyfMumrEs8F5t6HZ0uECTBnag7r3p7H1NPZVnXYZ4lbwV2V7WG+Qc Td4GMqJoNNaQ1SutD+Kofv43KMVqKZEi+dHAGvufmgF6tvHvkYkfr1Nm/V21BevpBqh6 woqg== MIME-Version: 1.0 X-Received: by 10.42.64.143 with SMTP id g15mr1725075ici.59.1415532509165; Sun, 09 Nov 2014 03:28:29 -0800 (PST) In-Reply-To: References: Date: Sun, 9 Nov 2014 22:28:29 +1100 Subject: Re: What is rstrip() in python? From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 27 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1415532518 news.xs4all.nl 2937 [2001:888:2000:d::a6]:50439 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:80423 On Sun, Nov 9, 2014 at 10:11 PM, 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