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. Advertisements

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:
    621
  2. moondaddy
    Replies:
    2
    Views:
    716
    Steven Cheng[MSFT]
    Oct 16, 2006
  3. Mr. SweatyFinger

    why why why why why

    Mr. SweatyFinger, Nov 28, 2006, in forum: ASP .Net
    Replies:
    4
    Views:
    1,347
    Mark Rae
    Dec 21, 2006
  4. Mr. SweatyFinger
    Replies:
    2
    Views:
    2,798
    Smokey Grindel
    Dec 2, 2006
  5. scad
    Replies:
    23
    Views:
    1,448
    Alf P. Steinbach
    May 17, 2009
  6. Michael Brooks
    Replies:
    22
    Views:
    695
    Rick DeNatale
    Mar 27, 2007
  7. Randy Kramer

    puts vs. write for writing to a file

    Randy Kramer, Oct 16, 2007, in forum: Ruby
    Replies:
    4
    Views:
    185
    Chad Perrin
    Oct 16, 2007
  8. Raj Singh
    Replies:
    4
    Views:
    289
    Ryan Ingram
    Jan 29, 2008
Loading...