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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T19:42:08+00:00 2026-05-13T19:42:08+00:00

I have a CSV file that i need to rearrange and renecode. I’d like

  • 0

I have a CSV file that i need to rearrange and renecode. I’d like to run

line = line.decode('windows-1250').encode('utf-8')

on each line before it’s parsed and split by the CSV reader. Or I’d like iterate over lines myself run the re-encoding and use just single line parsing form CSV library but with the same reader instance.

Is there a way to do that nicely?

  • 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-13T19:42:09+00:00Added an answer on May 13, 2026 at 7:42 pm

    Thx, for the answers. The wrapping one gave me an idea:

    def reencode(file):
        for line in file:
            yield line.decode('windows-1250').encode('utf-8')
    
    csv_writer = csv.writer(open(outfilepath,'w'), delimiter=',',quotechar='"', quoting=csv.QUOTE_MINIMAL)
    csv_reader = csv.reader(reencode(open(filepath)), delimiter=";",quotechar='"')
    for c in csv_reader:
        l = # rearange columns here
        csv_writer.writerow(l)
    

    That’s exactly what i was going for re-encoding a line just before it’s get parsed by the csv_reader.

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

Sidebar

Related Questions

I have a CSV file that is formatted like: 0.0023709,8.5752e-007,4.847e-008 and I would like
In short, I have a 20,000,000 line csv file that has different row lengths.
I have a csv file that has like 30,000 rows in it. It also
I have data stored in a csv file that looks like this: Date,BLOCK,,Wood,Miscellaneous,,Totals,MO Saturday,4055-RU,4055-AR,4091,1139,1158,,100
I have a CSV file with records that need to be sorted and then
I have a CSV file listing items that I need to store within the
I have a csv file that contains a location field. I need to import
I have a simple 3 column csv file that i need to use python
I have a CSV file that looks like this AS2345,ASDF1232, Mr. Plain Example, 110
I have a csv file that I need to revise, here is a snippet

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.