Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #52491 > unrolled thread

.split() Qeustion

Started byeschneider92@comcast.net
First post2013-08-13 21:51 -0700
Last post2013-08-16 21:31 -0700
Articles 15 on this page of 55 — 24 participants

Back to article view | Back to comp.lang.python


Contents

  .split() Qeustion eschneider92@comcast.net - 2013-08-13 21:51 -0700
    Re: .split() Qeustion Gary Herron <gary.herron@islandtraining.com> - 2013-08-13 22:12 -0700
      Re: .split() Qeustion Alister <alister.ware@ntlworld.com> - 2013-08-14 08:30 +0000
        Re: .split() Qeustion Joshua Landau <joshua@landau.ws> - 2013-08-14 11:31 +0100
          Re: .split() Qeustion Alister <alister.ware@ntlworld.com> - 2013-08-14 13:29 +0000
          Re: .split() Qeustion Duncan Booth <duncan.booth@invalid.invalid> - 2013-08-15 09:15 +0000
            Re: .split() Qeustion wxjmfauth@gmail.com - 2013-08-15 02:46 -0700
              Re: .split() Qeustion Chris Angelico <rosuav@gmail.com> - 2013-08-15 10:54 +0100
              Re: .split() Qeustion Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-08-15 11:22 +0000
                Re: .split() Qeustion wxjmfauth@gmail.com - 2013-08-15 06:58 -0700
        Re: .split() Qeustion Peter Otten <__peter__@web.de> - 2013-08-14 13:45 +0200
        Re: .split() Qeustion Joshua Landau <joshua@landau.ws> - 2013-08-14 12:55 +0100
          Re: .split() Qeustion wxjmfauth@gmail.com - 2013-08-14 07:32 -0700
            Re: .split() Qeustion random832@fastmail.us - 2013-08-14 13:05 -0400
              Re: .split() Qeustion Steven D'Aprano <steve@pearwood.info> - 2013-08-15 07:17 +0000
            Re: .split() Qeustion Chris Angelico <rosuav@gmail.com> - 2013-08-14 18:14 +0100
              Re: .split() Qeustion wxjmfauth@gmail.com - 2013-08-15 00:46 -0700
                Re: .split() Qeustion Lele Gaifax <lele@metapensiero.it> - 2013-08-15 16:38 +0200
                Re: .split() Qeustion MRAB <python@mrabarnett.plus.com> - 2013-08-15 15:54 +0100
                Re: .split() Qeustion Lele Gaifax <lele@metapensiero.it> - 2013-08-15 17:30 +0200
                Re: .split() Qeustion Chris Angelico <rosuav@gmail.com> - 2013-08-15 16:43 +0100
                  Re: .split() Qeustion Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-08-16 04:13 +0000
                    Re: .split() Qeustion Roy Smith <roy@panix.com> - 2013-08-16 00:29 -0400
                      Re: .split() Qeustion Dave Angel <davea@davea.name> - 2013-08-16 05:27 +0000
                        Re: .split() Qeustion Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-08-17 02:38 +0000
                          Re: .split() Qeustion Chris Angelico <rosuav@gmail.com> - 2013-08-17 03:45 +0100
                      Re: .split() Qeustion Gene Heskett <gheskett@wdtv.com> - 2013-08-16 10:30 -0400
                      Re: .split() Qeustion Gene Heskett <gheskett@wdtv.com> - 2013-08-16 10:24 -0400
                        Re: .split() Qeustion Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2013-08-17 11:16 +1200
                    Re: .split() Qeustion Ben Finney <ben+python@benfinney.id.au> - 2013-08-16 15:59 +1000
                      Re: .split() Qeustion Roy Smith <roy@panix.com> - 2013-08-16 07:14 -0400
                        Re: .split() Qeustion wxjmfauth@gmail.com - 2013-08-16 06:14 -0700
                          Re: .split() Qeustion Roy Smith <roy@panix.com> - 2013-08-16 09:23 -0400
                            Re: .split() Qeustion wxjmfauth@gmail.com - 2013-08-17 01:09 -0700
                              Re: .split() Qeustion Roy Smith <roy@panix.com> - 2013-08-17 07:55 -0400
                              Re: .split() Qeustion Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2013-08-18 11:30 +1200
                                Re: .split() Qeustion wxjmfauth@gmail.com - 2013-08-18 00:17 -0700
                        Re: .split() Qeustion Grant Edwards <invalid@invalid.invalid> - 2013-08-16 13:59 +0000
                Re: .split() Qeustion Joshua Landau <joshua@landau.ws> - 2013-08-15 17:54 +0100
                Re: .split() Qeustion Chris Angelico <rosuav@gmail.com> - 2013-08-15 19:28 +0100
                  Re: .split() Qeustion Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-08-16 04:17 +0000
                Re: .split() Qeustion Joshua Landau <joshua@landau.ws> - 2013-08-15 19:40 +0100
                Re: .split() Qeustion Terry Reedy <tjreedy@udel.edu> - 2013-08-15 17:40 -0400
                  Re: .split() Qeustion Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-08-16 04:22 +0000
                Re: .split() Qeustion Dave Angel <davea@davea.name> - 2013-08-15 22:56 +0000
                  Re: .split() Qeustion Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-08-16 04:39 +0000
                    Re: .split() Qeustion Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-08-16 04:41 +0000
            Re: .split() Qeustion Tim Chase <python.list@tim.thechases.com> - 2013-08-14 12:29 -0500
            Re: .split() Qeustion Skip Montanaro <skip@pobox.com> - 2013-08-14 12:38 -0500
            Re: .split() Qeustion Chris Angelico <rosuav@gmail.com> - 2013-08-14 18:46 +0100
            Re: .split() Qeustion Terry Reedy <tjreedy@udel.edu> - 2013-08-14 15:45 -0400
    Re: .split() Qeustion Dave Angel <davea@davea.name> - 2013-08-14 05:35 +0000
    Re: .split() Qeustion eschneider92@comcast.net - 2013-08-13 22:44 -0700
    Re: .split() Qeustion Krishnan Shankar <i.am.songoku@gmail.com> - 2013-08-13 22:37 -0700
    .split() Qeustion "Alfonso Andalon Jr." <alfonsoandalon@gmail.com> - 2013-08-16 21:31 -0700

Page 3 of 3 — ← Prev page 1 2 [3]


#52573

FromSteven D'Aprano <steve+comp.lang.python@pearwood.info>
Date2013-08-16 04:17 +0000
Message-ID<520da7c9$0$30000$c3e8da3$5496439d@news.astraweb.com>
In reply to#52565
On Thu, 15 Aug 2013 19:28:46 +0100, Chris Angelico wrote:

> On Thu, Aug 15, 2013 at 5:54 PM, Joshua Landau <joshua@landau.ws> wrote:
>> On 15 August 2013 16:43, Chris Angelico <rosuav@gmail.com> wrote:
>>> A mole is as much a number (6e23) as the light year is a number
>>> (9.5e15).
>>
>> A mole is a number. A light year is a unit.
> 
> A mole is an amount of something. Avogadro's Number is a number, which
> is what I was hinting at :)

Would you consider "a dozen" to be a number? Normally we use dozen only 
in reference to a dozen of something, not as an abstract pure number, but 
it's still a number in a way that "light-year" (or "mile", or "gram", or 
"second") is not.

Mole is like dozen. Light-year is like mile. And Avagadro's Number is 
like "twelve", only a bit bigger :-)


-- 
Steven

[toc] | [prev] | [next] | [standalone]


#52566

FromJoshua Landau <joshua@landau.ws>
Date2013-08-15 19:40 +0100
Message-ID<mailman.608.1376592083.1251.python-list@python.org>
In reply to#52540
On 15 August 2013 19:28, Chris Angelico <rosuav@gmail.com> wrote:
> On Thu, Aug 15, 2013 at 5:54 PM, Joshua Landau <joshua@landau.ws> wrote:
>> On 15 August 2013 16:43, Chris Angelico <rosuav@gmail.com> wrote:
>>> A mole is as much a number (6e23) as the light year is a number (9.5e15).
>>
>> A mole is a number. A light year is a unit.
>
> A mole is an amount of something. Avogadro's Number is a number, which
> is what I was hinting at :)

I stand corrected.

[toc] | [prev] | [next] | [standalone]


#52569

FromTerry Reedy <tjreedy@udel.edu>
Date2013-08-15 17:40 -0400
Message-ID<mailman.609.1376602858.1251.python-list@python.org>
In reply to#52540
On 8/15/2013 2:28 PM, Chris Angelico wrote:
> On Thu, Aug 15, 2013 at 5:54 PM, Joshua Landau <joshua@landau.ws> wrote:
>> On 15 August 2013 16:43, Chris Angelico <rosuav@gmail.com> wrote:
>>> A mole is as much a number (6e23) as the light year is a number (9.5e15).
>>
>> A mole is a number. A light year is a unit.
>
> A mole is an amount of something. Avogadro's Number is a number, which
> is what I was hinting at :)

The unit for 'mole' is 'ion', 'atom', or 'molecule', as appropriate for 
the 'something'. In other words, the units are the reacting input units 
and resulting output units in a particular chemical reaction.

-- 
Terry Jan Reedy

[toc] | [prev] | [next] | [standalone]


#52574

FromSteven D'Aprano <steve+comp.lang.python@pearwood.info>
Date2013-08-16 04:22 +0000
Message-ID<520da917$0$30000$c3e8da3$5496439d@news.astraweb.com>
In reply to#52569
On Thu, 15 Aug 2013 17:40:43 -0400, Terry Reedy wrote:

> On 8/15/2013 2:28 PM, Chris Angelico wrote:
>> On Thu, Aug 15, 2013 at 5:54 PM, Joshua Landau <joshua@landau.ws>
>> wrote:
>>> On 15 August 2013 16:43, Chris Angelico <rosuav@gmail.com> wrote:
>>>> A mole is as much a number (6e23) as the light year is a number
>>>> (9.5e15).
>>>
>>> A mole is a number. A light year is a unit.
>>
>> A mole is an amount of something. Avogadro's Number is a number, which
>> is what I was hinting at :)
> 
> The unit for 'mole' is 'ion', 'atom', or 'molecule', as appropriate for
> the 'something'. In other words, the units are the reacting input units
> and resulting output units in a particular chemical reaction.

Careful about the use of the word "unit", you're likely to confuse people 
into thinking "atom" is a unit of measurement like inches, seconds, grams 
or ohms. 

Naturally when dealing with moles of substance you have to take into 
account the kind of substance. In much the same way it makes a difference 
whether you are catering for a dozen people, a dozen couples, or a dozen 
football teams, a mole of oxygen molecules is not the same as a mole of 
oxygen atoms. But it's still the same number of things in each case, only 
the thing differs.


-- 
Steven

[toc] | [prev] | [next] | [standalone]


#52570

FromDave Angel <davea@davea.name>
Date2013-08-15 22:56 +0000
Message-ID<mailman.610.1376607442.1251.python-list@python.org>
In reply to#52540
Terry Reedy wrote:

> On 8/15/2013 2:28 PM, Chris Angelico wrote:
>> On Thu, Aug 15, 2013 at 5:54 PM, Joshua Landau <joshua@landau.ws> wrote:
>>> On 15 August 2013 16:43, Chris Angelico <rosuav@gmail.com> wrote:
>>>> A mole is as much a number (6e23) as the light year is a number (9.5e15).
>>>
>>> A mole is a number. A light year is a unit.
>>
>> A mole is an amount of something. Avogadro's Number is a number, which
>> is what I was hinting at :)
>
> The unit for 'mole' is 'ion', 'atom', or 'molecule', as appropriate for 
> the 'something'. In other words, the units are the reacting input units 
> and resulting output units in a particular chemical reaction.
>

To expand a little on that, the unit of "amount of something" is a "gram
mole", which is 6.2 **23 grams times the molecular (or atomic) weight.

My dad (research chemist) used to have to order supplies for his lab in
"ton moles", and he used some very small multipliers, since he usually
needed a kilogram or less in his lab.

-- 
DaveA

[toc] | [prev] | [next] | [standalone]


#52576

FromSteven D'Aprano <steve+comp.lang.python@pearwood.info>
Date2013-08-16 04:39 +0000
Message-ID<520dacf3$0$30000$c3e8da3$5496439d@news.astraweb.com>
In reply to#52570
On Thu, 15 Aug 2013 22:56:57 +0000, Dave Angel wrote:

> To expand a little on that, the unit of "amount of something" is a "gram
> mole", which is 6.2 **23 grams times the molecular (or atomic) weight.

The unit of amount of substance is mole. Gram-mole is an unfortunate 
synonym for mole. Unfortunate, because it looks like it should have 
dimensions of Mass, but it is actually a dimensionless number, and 
exactly equal to mole.

As usual, we can blame the damn engineers and their sloppy, ad-hoc 
thinking for abominations like this:

http://web.utk.edu/~dad/mole.html

Also, you're quoting Avogadro's Constant incorrectly: it's 6.02e23, or if 
you prefer, 6.02*10**23, not 6.2**23, which is a factor of about 358581 
too small.


> My dad (research chemist) used to have to order supplies for his lab in
> "ton moles", and he used some very small multipliers, since he usually
> needed a kilogram or less in his lab.

That's just sad. The supplier won't be counting out individual molecules, 
they'll be putting it on a scale and weighing it. So your dad had to 
convert the desired weight into a ridiculously impractical unit to place 
the order, and the supplier no doubt had to convert that unit back into 
mass in order to weigh it out and supply it. If you want a kilogram of X, 
why not order a kilogram of X, instead of converting it into megamol?

Sigh, I know the answer to that question. "We've always done it this way."


-- 
Steven

[toc] | [prev] | [next] | [standalone]


#52577

FromSteven D'Aprano <steve+comp.lang.python@pearwood.info>
Date2013-08-16 04:41 +0000
Message-ID<520dad93$0$30000$c3e8da3$5496439d@news.astraweb.com>
In reply to#52576
On Fri, 16 Aug 2013 04:39:16 +0000, Steven D'Aprano wrote:

> On Thu, 15 Aug 2013 22:56:57 +0000, Dave Angel wrote:
> 
>> To expand a little on that, the unit of "amount of something" is a
>> "gram mole", which is 6.2 **23 grams times the molecular (or atomic)
>> weight.
> 
> The unit of amount of substance is mole. Gram-mole is an unfortunate
> synonym for mole. 

Oops, dropped a word there... 

The *SI unit* of amount of substance.



-- 
Steven

[toc] | [prev] | [next] | [standalone]


#52527

FromTim Chase <python.list@tim.thechases.com>
Date2013-08-14 12:29 -0500
Message-ID<mailman.582.1376501324.1251.python-list@python.org>
In reply to#52519
On 2013-08-14 18:14, Chris Angelico wrote:
> On Wed, Aug 14, 2013 at 6:05 PM,  <random832@fastmail.us> wrote:
> > On Wed, Aug 14, 2013, at 10:32, wxjmfauth@gmail.com wrote:
> >> I'm always and still be suprised by the number of hard coded
> >> '\n' one can find in Python code when the portable (here
> >> win)
> >>
> >> >>> os.linesep
> >> '\r\n'
> >>
> >> exists.
> >
> > Because high-level code isn't supposed to use the os module
> > directly. Text-mode streams automatically convert newlines you
> > write to them.
> 
> I'm always, and will still be, surprised by the number of hard coded
> decimal integers one can find in Python code, when the portable way
> to do it is to use ctypes and figure out whether your literals
> should be big-endian or little-endian, 32-bit or 64-bit, etc. Yet
> people continue to just put decimal literals in their code! It
> can't be portable.

No, no, no...you want

  from sys.platform.integers import 0, 1, 2, 3, 14, 42

to be portable against endian'ness and bit-width.  Granted, one might
confuse them with regular numeric literals, so it would be best to
clarify them by namespace:

  import sys
  answer_to_life = sys.platform.integers.42
  print(sum(range(sys.platform.integers.0, sys.platform.integers.14)))

That way you ensure platform independence, and *much* clearer! ;-)

-tkc


[toc] | [prev] | [next] | [standalone]


#52528

FromSkip Montanaro <skip@pobox.com>
Date2013-08-14 12:38 -0500
Message-ID<mailman.583.1376501891.1251.python-list@python.org>
In reply to#52519
On Wed, Aug 14, 2013 at 12:05 PM,  <random832@fastmail.us> wrote:
> Because high-level code isn't supposed to use the os module directly.

That seems a bit extreme.  One would hope that Guido and the rest of
the crew created the os module so people would use it instead of
resorting to other lower level hacks.  A quick find/grep of my own
code suggests that I import os more than sys.  I use it mostly for
os.path.* and os.environ.  I'm not sure there's a higher level way to
access them without putting more layers between your code and those
objects, which code would obviously have to call them anyway.

Did I just misread your comment?

Skip

[toc] | [prev] | [next] | [standalone]


#52529

FromChris Angelico <rosuav@gmail.com>
Date2013-08-14 18:46 +0100
Message-ID<mailman.584.1376502377.1251.python-list@python.org>
In reply to#52519
On Wed, Aug 14, 2013 at 6:29 PM, Tim Chase
<python.list@tim.thechases.com> wrote:
> On 2013-08-14 18:14, Chris Angelico wrote:
>> On Wed, Aug 14, 2013 at 6:05 PM,  <random832@fastmail.us> wrote:
>> > On Wed, Aug 14, 2013, at 10:32, wxjmfauth@gmail.com wrote:
>> >> I'm always and still be suprised by the number of hard coded
>> >> '\n' one can find in Python code when the portable (here
>> >> win)
>> >>
>> >> >>> os.linesep
>> >> '\r\n'
>> >>
>> >> exists.
>> >
>> > Because high-level code isn't supposed to use the os module
>> > directly. Text-mode streams automatically convert newlines you
>> > write to them.
>>
>> I'm always, and will still be, surprised by the number of hard coded
>> decimal integers one can find in Python code, when the portable way
>> to do it is to use ctypes and figure out whether your literals
>> should be big-endian or little-endian, 32-bit or 64-bit, etc. Yet
>> people continue to just put decimal literals in their code! It
>> can't be portable.
>
> No, no, no...you want
>
>   from sys.platform.integers import 0, 1, 2, 3, 14, 42
>
> to be portable against endian'ness and bit-width.

Oh! I didn't know about sys.platform.integers. All this time I've been
doing it manually, usually copying and pasting a block of integer
definitions from the re module. (I used to copy them from
adamant.princess.ida but some of them were buggy. 2+2 made 5, or 3, or
7, or 25, depending on need.)

ChrisA

[toc] | [prev] | [next] | [standalone]


#52532

FromTerry Reedy <tjreedy@udel.edu>
Date2013-08-14 15:45 -0400
Message-ID<mailman.587.1376509523.1251.python-list@python.org>
In reply to#52519
On 8/14/2013 1:05 PM, random832@fastmail.us wrote:
> On Wed, Aug 14, 2013, at 10:32, wxjmfauth@gmail.com wrote:
>> I'm always and still be suprised by the number of hard coded
>> '\n' one can find in Python code when the portable (here
>> win)
>>
>>>>> os.linesep
>> '\r\n'
>>
>> exists.

> Because high-level code isn't supposed to use the os module directly.

This is a bit extreme, but definitely true for os.linesep and *much* of 
os other than os.path and maybe os.environ.

> Text-mode streams automatically convert newlines you write to them.

By default, <any possible linesep> to \n when reading files;, \n to 
os.linesep when writing. Windows is the only major OS for which 
os.linesep is not \n.

The full details, from the builtin 'open' entry:
"
newline controls how universal newlines mode works (it only applies to 
text mode). It can be None, '', '\n', '\r', and '\r\n'. It works as follows:

     When reading input from the stream, if newline is None, universal 
newlines mode is enabled. Lines in the input can end in '\n', '\r', or 
'\r\n', and these are translated into '\n' before being returned to the 
caller. If it is '', universal newlines mode is enabled, but line 
endings are returned to the caller untranslated. If it has any of the 
other legal values, input lines are only terminated by the given string, 
and the line ending is returned to the caller untranslated.

     When writing output to the stream, if newline is None, any '\n' 
characters written are translated to the system default line separator, 
os.linesep. If newline is '' or '\n', no translation takes place. If 
newline is any of the other legal values, any '\n' characters written 
are translated to the given string.
"

-- 
Terry Jan Reedy

[toc] | [prev] | [next] | [standalone]


#52493

FromDave Angel <davea@davea.name>
Date2013-08-14 05:35 +0000
Message-ID<mailman.561.1376458565.1251.python-list@python.org>
In reply to#52491
eschneider92@comcast.net wrote:

> How can I use the '.split()' method (am I right in calling it a method?) without instead of writing each comma between words in the pie list in the following code? Also, is there a way to use .split instead of typing the apostrophes? Thank you.
>
> import random
> pie=['keylime', 'peach', 'apple', 'cherry', 'pecan']
> print(random.choice(pie))
>

I can't make any sense out of the first sentence.  But maybe I can guess
what you're looking for.

The split() method is indeed a method of the str class.  It takes an
optional argument for the separator character. By default it uses
whitespace. So if you're trying to specify a series of items, none of
which contain any whitespace, you can readily use split to build your
list:

pie = "keylime peach apple cherry pecan".split()

However, there'd be no way to specify an item called "chocolate
marshmallow".  If you need to include whitespace in any item, then you'd
have to use some other separator, like a comma:

pie = "keylime,chocolate marshmallow,peach,apple,cherry,
pecan".split(",")



-- 
Signature file not found

[toc] | [prev] | [next] | [standalone]


#52494

Fromeschneider92@comcast.net
Date2013-08-13 22:44 -0700
Message-ID<5198daa0-fe17-44cc-bd6b-8ba4dddd1333@googlegroups.com>
In reply to#52491
It's obvious that the word 'without' in my first sentence was meant to be ommited, and it's a simple question. Thank Gary!

[toc] | [prev] | [next] | [standalone]


#52495

FromKrishnan Shankar <i.am.songoku@gmail.com>
Date2013-08-13 22:37 -0700
Message-ID<mailman.562.1376459009.1251.python-list@python.org>
In reply to#52491

[Multipart message — attachments visible in raw view] — view raw

Hi,

>How can I use the '.split()' method (am I right in calling it a method?)

The .split() is a method in Python which comes as in built method for
String objects in Python. Any string defined in python will have the
ability to call this function.

>>> var = 'Hello how r u?'
>>> dir(var)
['__add__', '__class__', '__contains__', '__delattr__', '__doc__',
'__eq__', '__ge__', '__getattribute__', '__getitem__', '__getnewargs__',
'__getslice__', '__gt__', '__hash__', '__init__', '__le__', '__len__',
'__lt__', '__mod__', '__mul__', '__ne__', '__new__', '__reduce__',
'__reduce_ex__', '__repr__', '__rmod__', '__rmul__', '__setattr__',
'__str__', 'capitalize', 'center', 'count', 'decode', 'encode', 'endswith',
'expandtabs', 'find', 'index', 'isalnum', 'isalpha', 'isdigit', 'islower',
'isspace', 'istitle', 'isupper', 'join', 'ljust', 'lower', 'lstrip',
'replace', 'rfind', 'rindex', 'rjust', 'rsplit', 'rstrip', 'split',
'splitlines', 'startswith', 'strip', 'swapcase', 'title', 'translate',
'upper', 'zfill']
>>> var.split()
['Hello', 'how', 'r', 'u?']
>>>

>writing each comma between words in the pie list in the following code?
Also, is there >a way to use .split instead of typing the apostrophes?
Thank you.

>import random
>pie=['keylime', 'peach', 'apple', 'cherry', 'pecan']
>print(random.choice(pie))

If you are talking about having predefined list pie with limited elements
like above it is ok to code them straightaway with apostrophes and others
will know that it is a predefined list.

Suppose if the elements in list come as a line in a file or is a string, it
will be better to use split() method and form a list. I hope Gary has
provided the example for the same.

pie = 'keylime peach apple cherry pecan'.split()

I hope this clarifies your doubt.

Regards,
Krishnan



On Tue, Aug 13, 2013 at 9:51 PM, <eschneider92@comcast.net> wrote:

> How can I use the '.split()' method (am I right in calling it a method?)
> without instead of writing each comma between words in the pie list in the
> following code? Also, is there a way to use .split instead of typing the
> apostrophes? Thank you.
>
> import random
> pie=['keylime', 'peach', 'apple', 'cherry', 'pecan']
> print(random.choice(pie))
>
> Eric
> --
> http://mail.python.org/mailman/listinfo/python-list
>

[toc] | [prev] | [next] | [standalone]


#52618

From"Alfonso Andalon Jr." <alfonsoandalon@gmail.com>
Date2013-08-16 21:31 -0700
Message-ID<be6fdf41-a451-4c5e-96cd-1c37195166a3@googlegroups.com>
In reply to#52491


[toc] | [prev] | [standalone]


Page 3 of 3 — ← Prev page 1 2 [3]

Back to top | Article view | comp.lang.python


csiph-web