[Baypiggies] String Utility Question

Simeon Franklin simeonf at gmail.com
Wed Jul 22 02:52:55 CEST 2015


The split() method exists on several different kinds of objects, modules
etc. You have to know what kind of thing you have in order to find its
documentation.

In your examples it looks like you're splitting a string. Python docs are
available at
https://docs.python.org/2/library/string.html?highlight=split#string.split
but a really important skill is learning to access the built-in help from
the interactive Python shell. For example if you know that "str" is the
built in string type you could use the help function like so:

$ python
Python 2.7.9 (default, Apr  1 2015, 12:47:56)
Type "help", "copyright", "credits" or "license" for more information.
>>> help(str.split) # I'm asking for help on the str.split method
split(...)
    S.split([sep [,maxsplit]]) -> list of strings
    Return a list of the words in the string S, using sep as the
    delimiter string.  If maxsplit is given, at most maxsplit
    splits are done. If sep is not specified or is None, any
    whitespace string is a separator and empty strings are removed
    from the result.

On Tue, Jul 21, 2015 at 5:11 PM, <admin.dslcomputer at gmail.com> wrote:

>  Hi Everyone:
>
> Where can I find documentation on "line.split()"
>
> The Python online documentation site contains no available search term for
> "line.split()",i.e., URL link at
> https://www.python.org/downloads/release/python-279/
>
> Moreover, the Python Library Reference refers to the utility function as
> an ArgumentParser: "def convert_arg_line_to_args(self, arg_line): return
> arg_line.split()", i.e., The Python Library Reference, Release 2.7.10;
> 15.4. argparse — Parser for command-line options, arguments and
> sub-commands p. 475.
>
> Likewise, the Python Tutorial refers to the utility function as a
> Generator Expressions: "unique_words = set(word for line in page for word
> in line.split())”,i.e., Python Tutorial, Release 2.7.10; 9.11. Generator
> Expressions p. 75
>
> Regards,
> Hal
>
> Sent from Surface
>
>
> _______________________________________________
> Baypiggies mailing list
> Baypiggies at python.org
> To change your subscription options or unsubscribe:
> https://mail.python.org/mailman/listinfo/baypiggies
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/baypiggies/attachments/20150721/5938f032/attachment-0001.html>


More information about the Baypiggies mailing list