join , split question

Discussion in 'Python' started by elca, Nov 4, 2009.

  1. elca

    elca Guest

    elca, Nov 4, 2009
    #1
    1. Advertising

  2. elca a écrit :
    > Hello,
    > i have some text file list such like following format.
    > i want to change text format to other format.
    > i was upload it pastebin site
    > http://elca.pastebin.com/d71261168


    Dead link.

    > if anyone help


    With what ?
    Bruno Desthuilliers, Nov 5, 2009
    #2
    1. Advertising

  3. Stuart Murray-Smith, Nov 5, 2009
    #3
  4. Stuart Murray-Smith a écrit :
    >>> Hello, i have some text file list such like following format.
    >>> i want to change text format to other format.
    >>> i was upload it pastebin site
    >>> http://elca.pastebin.com/d71261168

    >
    >> Dead link.

    >
    >> With what ?

    >
    > http://elca.pastebin.com/d4d57929a
    >


    Yeah, fine. And where's the code you or the OP (if not the same person)
    have problems with ?
    Bruno Desthuilliers, Nov 5, 2009
    #4
  5. elca

    Jon Clements Guest

    On Nov 5, 2:08 pm, Bruno Desthuilliers <bruno.
    > wrote:
    > Stuart Murray-Smith a écrit :
    >
    > >>> Hello, i have some text file list such like following format.
    > >>> i want to change text format to other format.
    > >>>  i was upload it pastebin site
    > >>>http://elca.pastebin.com/d71261168

    >
    > >> Dead link.

    >
    > >> With what ?

    >
    > >http://elca.pastebin.com/d4d57929a

    >
    > Yeah, fine. And where's the code you or the OP (if not the same person)
    > have problems with ?


    I'd certainly be curious to see it, especially with the pagecheck()
    line 22 @ http://elca.pastebin.com/f5c69fe41
    Jon Clements, Nov 5, 2009
    #5
  6. elca

    metal Guest

    On 11月4æ—¥, 下åˆ5æ—¶39分, elca <> wrote:
    > Hello,
    > i have some text file list such like following format.
    > i want to change text format to other format.
    >  i was upload it pastebin sitehttp://elca.pastebin.com/d71261168
    >
    > if anyone help ,much appreciate thanks in advance
    > --
    > View this message in context:http://old.nabble.com/join-,-split-question-tp26193334p26193334.html
    > Sent from the Python - python-list mailing list archive at Nabble.com.


    s = """uji708
    uhodih
    utus29
    agamu4
    azi340
    ekon62
    """

    from itertools import cycle
    for i, x in zip(cycle(range(3)), s.splitlines()):
    print x + ',',
    if i == 2:
    print

    """
    uji708, uhodih, utus29,
    agamu4, azi340, ekon62,
    """
    metal, Nov 6, 2009
    #6
  7. elca

    metal Guest

    On 11月6æ—¥, 上åˆ8æ—¶34分, metal <> wrote:
    > On 11月4æ—¥, 下åˆ5æ—¶39分, elca <> wrote:
    >
    > > Hello,
    > > i have some text file list such like following format.
    > > i want to change text format to other format.
    > >  i was upload it pastebin sitehttp://elca.pastebin.com/d71261168

    >
    > > if anyone help ,much appreciate thanks in advance
    > > --
    > > View this message in context:http://old.nabble.com/join-,-split-question-tp26193334p26193334.html
    > > Sent from the Python - python-list mailing list archive at Nabble.com.

    >
    > s = """uji708
    > uhodih
    > utus29
    > agamu4
    > azi340
    > ekon62
    > """
    >
    > from itertools import cycle
    > for i, x in zip(cycle(range(3)), s.splitlines()):
    >     print x + ',',
    >     if i == 2:
    >         print
    >
    > """
    > uji708, uhodih, utus29,
    > agamu4, azi340, ekon62,
    > """


    yet another version, a little evil

    s = """uji708
    uhodih
    utus29
    agamu4
    azi340
    ekon62
    """

    from itertools import *
    print '\n'.join(','.join(x for i, x in g) for k, g in groupby(enumerate
    (s.splitlines()), lambda (i, x): i/3))
    """
    uji708,uhodih,utus29
    agamu4,azi340,ekon62
    """
    metal, Nov 6, 2009
    #7
  8. elca

    elca Guest

    Jon Clements-2 wrote:
    >
    > On Nov 5, 2:08 pm, Bruno Desthuilliers <bruno.
    > > wrote:
    >> Stuart Murray-Smith a écrit :
    >>
    >> >>> Hello, i have some text file list such like following format.
    >> >>> i want to change text format to other format.
    >> >>>  i was upload it pastebin site
    >> >>>http://elca.pastebin.com/d71261168

    >>
    >> >> Dead link.

    >>
    >> >> With what ?

    >>
    >> >http://elca.pastebin.com/d4d57929a

    >>
    >> Yeah, fine. And where's the code you or the OP (if not the same person)
    >> have problems with ?

    >
    > I'd certainly be curious to see it, especially with the pagecheck()
    > line 22 @ http://elca.pastebin.com/f5c69fe41
    >
    > --
    > http://mail.python.org/mailman/listinfo/python-list
    >
    >

    thanks all!
    i was resolved :)

    --
    View this message in context: http://old.nabble.com/join-,-split-question-tp26193334p26225646.html
    Sent from the Python - python-list mailing list archive at Nabble.com.
    elca, Nov 6, 2009
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    2
    Views:
    445
  2. Alan Silver
    Replies:
    0
    Views:
    864
    Alan Silver
    Jun 5, 2006
  3. Carlos Ribeiro
    Replies:
    11
    Views:
    679
    Alex Martelli
    Sep 17, 2004
  4. googleboy
    Replies:
    1
    Views:
    903
    Benji York
    Oct 1, 2005
  5. Gunter Hansen
    Replies:
    5
    Views:
    916
    Roedy Green
    Sep 1, 2011
Loading...

Share This Page