why writing list to file puts each item from list on seperate line?

Discussion in 'Python' started by homepricemaps@gmail.com, Dec 31, 2005.

  1. Guest

    if i use the code below to write a list to a file

    list = (food, price, store)
    data.append(list)
    f = open(r"test.txt", 'a')
    f.write ( os.linesep.join( list ) )


    it outputs to a file like this

    apple
    ..49
    star market

    and i want it to do

    apple, .49. star market

    any ideas
    , Dec 31, 2005
    #1
    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:
    5
    Views:
    470
  2. Mr. SweatyFinger
    Replies:
    2
    Views:
    1,840
    Smokey Grindel
    Dec 2, 2006
  3. scad
    Replies:
    23
    Views:
    1,162
    Alf P. Steinbach
    May 17, 2009
  4. Michael Brooks
    Replies:
    22
    Views:
    409
    Rick DeNatale
    Mar 27, 2007
  5. Raj Singh
    Replies:
    4
    Views:
    139
    Ryan Ingram
    Jan 29, 2008
Loading...

Share This Page