copying a tuple to a list..

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • sergio@village-buzz.com

    #1

    copying a tuple to a list..


    i have a result tuple from a MySQLdb call that would like to change in
    place..

    i would like to copy it to a list, so i can modify it in place, but i
    cannot figure out how to do it.

    the result typle is

    dataResults

    and i thought i could do something like

    dataList = []

    dataList = dataResults

    but that doesn't work very well..

    anyway.. thanks for the help..

  • Ed Leafe

    #2
    Re: copying a tuple to a list..

    On Mar 6, 2006, at 12:42 PM, sergio@village-buzz.com wrote:
    [color=blue]
    > i have a result tuple from a MySQLdb call that would like to change in
    > place..
    >
    > i would like to copy it to a list, so i can modify it in place, but i
    > cannot figure out how to do it.
    >
    > the result typle is
    >
    > dataResults[/color]

    dataList = list(dataResult s)


    -- Ed Leafe
    -- http://leafe.com
    -- http://dabodev.com



    Comment

    • Sybren Stuvel

      #3
      Re: copying a tuple to a list..

      sergio@village-buzz.com enlightened us with:[color=blue]
      > i have a result tuple from a MySQLdb call that would like to change in
      > place..
      >
      > i would like to copy it to a list, so i can modify it in place, but i
      > cannot figure out how to do it.[/color]

      dataResults = (1, 2, 12)
      dataList = list(dataResult s)

      Sybren
      --
      The problem with the world is stupidity. Not saying there should be a
      capital punishment for stupidity, but why don't we just take the
      safety labels off of everything and let the problem solve itself?
      Frank Zappa

      Comment

      • Scott David Daniels

        #4
        Re: copying a tuple to a list..

        sergio@village-buzz.com wrote:[color=blue]
        > i have a result tuple from a MySQLdb call that would like to change in
        > place..[/color]

        What you probably want:
        source = (1, 2, 'three')
        wanted = list(source)

        --Scott David Daniels
        scott.daniels@a cm.org

        Comment

        Working...