MRAB:
> I also had the thought that the backtick (`), which is not used in
> Python 3, could be used to form character set literals (`aeiou` =>
> set("aeiou")), although that might only be worth while if character
> sets were introduced as an specialised form of set.
Python developers have removed
On Nov 4, 8:00 pm, [EMAIL PROTECTED] wrote:
> MRAB:
>
> > It's interesting, if you think about it, that here we have someone who
> > wants to split on a set of characters but 'split' splits on a string,
> > and others sometimes want to strip off a string but 'strip' strips on
> > a set of character
MRAB:
> It's interesting, if you think about it, that here we have someone who
> wants to split on a set of characters but 'split' splits on a string,
> and others sometimes want to strip off a string but 'strip' strips on
> a set of characters (passed as a string).
That can be seen as a little in
That is a very creative solution! Thank you Scott.
> Or, for faster per-repetition (blending in to your use-case):
>
> import string
> SEP = string.maketrans('abc \t', ' ')
> ...
> parts = 'whatever, abalone dudes'.translate(SEP).split()
> print parts
>
> ['wh', 'tever
Steven D'Aprano wrote:
On Fri, 31 Oct 2008 12:18:32 -0700, Chaim Krause wrote:
I have arrived here while attempting to break down a larger problem. I
got to this question when attempting to split a line on any whitespace
character so that I could then add several other characters like ';' and
':
On Fri, 31 Oct 2008 12:18:32 -0700, Chaim Krause wrote:
> I have arrived here while attempting to break down a larger problem. I
> got to this question when attempting to split a line on any whitespace
> character so that I could then add several other characters like ';' and
> ':'. Ultimately spl
On Oct 31, 6:57 pm, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote:
> On Fri, 31 Oct 2008 11:53:30 -0700, Chaim Krause wrote:
> > I am unable to figure out why the first two statements work as I expect
> > them to and the next two do not. Namely, the first two spit the sentence
> > into its com
On Oct 31, 2:12 pm, Chaim Krause <[EMAIL PROTECTED]> wrote:
> The documentation I am referencing states...
>
> The sep argument may consist of multiple characters (for example, "'1,
> 2, 3'.split(', ')" returns "['1', '2', '3']").
>
> So why doesn't the latter two split on *any* whitespace characte
I have arrived here while attempting to break down a larger problem. I
got to this question when attempting to split a line on any whitespace
character so that I could then add several other characters like ';'
and ':'. Ultimately splitting a line on any char in a union of
string.whitespace and som
The documentation I am referencing states...
The sep argument may consist of multiple characters (for example, "'1,
2, 3'.split(', ')" returns "['1', '2', '3']").
So why doesn't the latter two split on *any* whitespace character, and
is instead looking for the sep string as a whole?
--
http://mai
On Fri, Oct 31, 2008 at 11:53 AM, Chaim Krause <[EMAIL PROTECTED]> wrote:
> I am unable to figure out why the first two statements work as I
> expect them to and the next two do not. Namely, the first two spit the
> sentence into its component words, while the latter two return the
> whole sentence
I am unable to figure out why the first two statements work as I
expect them to and the next two do not. Namely, the first two spit the
sentence into its component words, while the latter two return the
whole sentence entact.
import string
from string import whitespace
mytext = "The quick brown f
On Fri, 31 Oct 2008 11:53:30 -0700, Chaim Krause wrote:
> I am unable to figure out why the first two statements work as I expect
> them to and the next two do not. Namely, the first two spit the sentence
> into its component words, while the latter two return the whole sentence
> entact.
>
> imp
13 matches
Mail list logo