Hi Chris,
Thank you very much, that was exactly what I needed.
Eric
On Jun 13, 9:29 am, Chris <[EMAIL PROTECTED]> wrote:
> On Jun 13, 4:15 pm, ericdaniel <[EMAIL PROTECTED]> wrote:
>
> > Hi,
>
> > I'm new to Python and I need to do the following:
>
> > from this: s = "978654321"
> > to this :
On Jun 14, 12:15 am, ericdaniel <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I'm new to Python and I need to do the following:
>
> from this: s = "978654321"
> to this : ["978", "654", "321"]
>
> Any help is appreciated
>
Homework?
Have you read the Python tutorial (section 3.1.2 Strings)?
--
http
ericdaniel wrote:
> I'm new to Python and I need to do the following:
>
> from this: s = "978654321"
> to this : ["978", "654", "321"]
Use a loop:
>>> s = "978654321"
>>> items = []
>>> for start in range(0, len(s), 3):
... items.append(s[start:start+3])
...
>>> items
['978', '654',
On Jun 13, 4:15 pm, ericdaniel <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I'm new to Python and I need to do the following:
>
> from this: s = "978654321"
> to this : ["978", "654", "321"]
>
> Any help is appreciated
>
> Thanks,
>
> Eric
What you could do is iterate over the string appending the
On Jun 13, 3:15 pm, ericdaniel <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I'm new to Python and I need to do the following:
>
> from this: s = "978654321"
> to this : ["978", "654", "321"]
What are your criteria for splitting this string? Every 3 characters?
If there isn't an even multiple of 3,
Hi,
I'm new to Python and I need to do the following:
from this: s = "978654321"
to this : ["978", "654", "321"]
Any help is appreciated
Thanks,
Eric
--
http://mail.python.org/mailman/listinfo/python-list