Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8117039
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T04:01:23+00:00 2026-06-06T04:01:23+00:00

I begin in Python language and face a problem with my script. On stackoverflow,

  • 0

I begin in Python language and face a problem with my script. On stackoverflow, i fould only a post where somebody asks how to write in columns, but form me it is the problem 🙂

I have two lists. The first one contains some other lists which content must be written in a csv file, the second one the name of the files to be created.

contentlist = [element1, element2 ... ]
namelist = ['element1', 'element2' ... ]

Each item of the list contentlist follows this model :

'url 1 | text1'

For output i would like something like this, url and text being divided by the | character :

Column1          Column2

url1             text1

url2             text2

My script is partially successful.

    for name, content in zip(namelist, contentlist):
        with open(name, 'w') as f:
        w = csv.writer(f, dialect = 'excel', delimiter=',')
        w.writerows([content]) 

But I get this output :

column1         column2

url1 | text1    url2 | text2

If i delete [ ] at the last line of my script, i manage ton get the output i’m wanting, but obviously there is a comma between each character.

Could someone help me ? Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T04:01:24+00:00Added an answer on June 6, 2026 at 4:01 am
    w.writerows(c.split(' | ') for c in content)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Just begin my Python/Django experience and i have a problem :-) So i have
I'm using Python to call bash to execute another bash script: begin = int(sys.argv[1])
To begin, not only are there two main dialects of the language (Common Lisp
Just switch from Python to C++ and I begin to re-write my Python tools
I have never written a python script in my life, but I have a
I use do auto indenting follow lines that begin with python keywords in Vim
I begin in GUI with Tkinter with Python. I'm trying to create a graphical
To begin with, I don't know the first thing about Python ... so I
To begin with, let me say that I understand how and why the problem
I'm using the example in python's 2.6 docs to begin a foray into embedding

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.