Path: csiph.com!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail From: Ian Kelly Newsgroups: comp.lang.python Subject: Re: Question about split method Date: Wed, 2 Dec 2015 14:44:30 -0600 Lines: 37 Message-ID: References: <169982db-7285-484a-9a48-0d4a2ea7dea1@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de gDOxxh9XU6zIty6lNCP5MQtO9YkSWzcOnGNIF7q3K5BA== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'received:209.85.223': 0.03; 'method.': 0.05; 'subject:Question': 0.05; 'method,': 0.07; 'globals': 0.09; 'imported': 0.09; 'subject:method': 0.09; 'output': 0.13; 'wed,': 0.15; '(within': 0.16; "['1',": 0.16; 'numpy': 0.16; 'received:209.85.223.173': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'wrote:': 0.16; 'string': 0.17; '2015': 0.20; 'parameter': 0.22; 'dec': 0.23; 'for?': 0.23; 'split': 0.23; 'thanks,': 0.24; 'import': 0.24; 'examples': 0.24; 'header:In-Reply-To:1': 0.24; 'module': 0.25; 'message- id:@mail.gmail.com': 0.27; 'function': 0.28; 'looks': 0.29; 'such.': 0.29; 'random': 0.29; 'skip:. 10': 0.32; 'run': 0.33; 'received:google.com': 0.35; 'robert': 0.35; 'received:209.85': 0.36; 'to:addr:python-list': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'method': 0.37; 'doing': 0.38; 'received:209': 0.38; 'hi,': 0.38; 'why': 0.39; 'to:addr:python.org': 0.40; 'some': 0.40; "'2',": 0.84; 'to:name:python': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=UKv4pS+DuVqU1gigMixBooROL3+PHsvweHRlvmuwUdY=; b=FtlJYuUS/UfMASZ+NjtETqwIfZNrE1/FGl5emQ6wD+uS8mjZGfECHsXX/zD4vF8d7M OXFOC3it/l3E3TgPChliefSX7YMDL19ZS4z3G5UGKmUmkaZpeIq600WRrt58+AIe5lQW vIgQndlaP02qkexpY8lhSCCE9uboArvZj8VxsD71lkD+8BYAsYtvuvuJMJWrJy7GmMis XLIlgUvIpgriX3MAA3mnf19mRQ3Dwts4eTDJneg7e6aJLa+TaOIkCQLYsGBg5NNx9utg JRUSQkXN4/qDmML8IYyNtMWeGNc+DSsLOQ525RBamWzPy/ZNGmlR9RvLE8Xm1aUNKlMp sQQw== X-Received: by 10.107.164.154 with SMTP id d26mr5581405ioj.111.1449089109591; Wed, 02 Dec 2015 12:45:09 -0800 (PST) In-Reply-To: <169982db-7285-484a-9a48-0d4a2ea7dea1@googlegroups.com> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:99914 On Wed, Dec 2, 2015 at 2:37 PM, Robert wrote: > Hi, > > I learn split method online. When I try to run the line with ss1 beginning, > I don't understand why its output of ss1 and ss2. I have check the help > about split. It looks like that it is a numpy method. > What is the split method parameter (within " ") for? > > > Thanks, > > > > ............... > ss0="1, 2, 4, 8, 16".split(", ") > > ss0 > Out[2]: ['1', '2', '4', '8', '16'] > > ss1="1, 2, 4, 8, 16".split(" , ") > > ss1 > Out[4]: ['1, 2, 4, 8, 16'] > > ss2="1, 2, 4, 8, 16".split(", ") > > ss2 > Out[9]: ['1, 2, 4, 8, 16'] > > help(split) > Help on function split in module numpy.lib.shape_base: That's just some random function that you've imported into globals by doing "from numpy import *" or some such. What you're calling in these examples is a string method, not a global function. Try help(str.split)