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 6715921
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T08:40:18+00:00 2026-05-26T08:40:18+00:00

I am completely new to python and struggling to make a simple thing work.

  • 0

I am completely new to python and struggling to make a simple thing work.

I am reading a bunch of information from a Web service, parsing the results, and I want to write it out into a flat-file. Most of my items are single line items, but one of the things I get back from my Web service is a paragraph. The paragraph will contain newlines, quotes, and any random characters.

I was going to use the CSV module for python, but unsure of the parameters I should use and how to escape my string so the paragraph gets put onto a single line and so I am guaranteed all characters are properly escaped (especially the delimiter)

  • 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-05-26T08:40:19+00:00Added an answer on May 26, 2026 at 8:40 am

    The default csv.writer setup should handle this properly. Here’s a simple example:

    import csv
    
    myparagraph = """
    this is a long paragraph, with "quotes" and stuff.
    """
    
    mycsv = csv.writer(open('foo.csv', 'wb'))
    mycsv.writerow([myparagraph, 'word1'])
    mycsv.writerow(['word2', 'word3'])
    

    This yields the following csv file:

    "
    this is a long paragraph, with ""quotes"" and stuff.
    ",word1
    word2,word3
    

    Which should load into your favorite csv opening tool with no problems, as a having two rows and two columns.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Disclaimer: completely new to Python from a PHP background Ok I'm using Python on
I'm completely new to Python and I've been trying to make a fibonacci program
Does python create a completely new string (copying the contents) when you do a
Completely new to asp.net mvc... completely new to web apps so bear with me...
I'm new to Python completely and am using Python 3.1 on Windows (pywin). I
I'm completely new to python (and it's been a while since I've coded much).
I'm completely new to Python and while trying various random bits and pieces I've
I am fairly new to Python programming, and completely new to cross-platform GUI building
I am completely new to web services, but not new to Delphi. I am
Firstly, I should say I'm completely new to Pylons, trying to learn web development

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.