Re: How to split string

2007-12-05 Thread Johny
Thank you all who replied particularly Chris and Tim. L. -- http://mail.python.org/mailman/listinfo/python-list

Re: How to split string

2007-12-05 Thread Neil Cerutti
On 2007-12-05, Tim Chase <[EMAIL PROTECTED]> wrote: > http://docs.python.org/lib/module-textwrap.html > > The Python library has already done all the heavy lifting--no > need to re-invent the wheel. Well no, clearly we need xwrap methods and a ctextwrap module. ;) -- Neil Cerutti -- http://mail

Re: How to split string

2007-12-05 Thread Tim Chase
> In other words, the string should be split at every 10th possition but > if the 10th character is space, then the string must be split at the > nearest space before the 10th possition. > > It could be better explained if the length of split strings will be > 20. > > S='this is just a random seq

Re: How to split string

2007-12-05 Thread Chris
On Dec 5, 1:46 pm, Johny <[EMAIL PROTECTED]> wrote: > On Dec 5, 11:55 am, Chris <[EMAIL PROTECTED]> wrote: > > > > > On Dec 5, 10:55 am, Johny <[EMAIL PROTECTED]> wrote: > > > > I have a string of a variable length and I need to split the string > > > in strings of 6 characters . > > > But if the 6

Re: How to split string

2007-12-05 Thread Johny
On Dec 5, 11:55 am, Chris <[EMAIL PROTECTED]> wrote: > On Dec 5, 10:55 am, Johny <[EMAIL PROTECTED]> wrote: > > > > > > > I have a string of a variable length and I need to split the string > > in strings of 6 characters . > > But if the 6th character is not space then I must split the string > > a

Re: How to split string

2007-12-05 Thread Peter Otten
Johny wrote: > I have a string of a variable length and I need to split the string > in strings of 6 characters . > But if the 6th character is not space then I must split the string > at possition before the 6th character. > > For example: > if the main string S is > > S='abcde fghc ijkl mnop

Re: How to split string

2007-12-05 Thread Chris
On Dec 5, 10:55 am, Johny <[EMAIL PROTECTED]> wrote: > I have a string of a variable length and I need to split the string > in strings of 6 characters . > But if the 6th character is not space then I must split the string > at possition before the 6th character. > > For example: > if the main str

How to split string

2007-12-05 Thread Johny
I have a string of a variable length and I need to split the string in strings of 6 characters . But if the 6th character is not space then I must split the string at possition before the 6th character. For example: if the main string S is S='abcde fghc ijkl mnop' the result should be abcde fg