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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T00:59:47+00:00 2026-06-07T00:59:47+00:00

I have a code where in I first convert a .csv file into multiple

  • 0

I have a code where in I first convert a .csv file into multiple lists and then I have to create a subset of the original file containing only those with a particular word in column 5 of my file.

I am trying to use the following code to do so, but it gives me a syntax error for the if statement. Can anyone tell me how to fix this?

import csv
with open('/Users/jadhav/Documents/Hubble files/m4_hubble_1.csv') as f:
    bl = [[],[],[],[],[]]
    reader = csv.reader(f)
    for r in reader:
        for c in range(5):
            bl[c].append(r[c])

    print "The files have now been sorted into lists"
    name = 'HST_10775_64_ACS_WFC_F814W_F606W'
    for c in xrange(0,1):
        if bl[4][c]!='HST_10775_64_ACS_WFC_F814W_F606W' 
            print bl[0][c] 
  • 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-07T00:59:49+00:00Added an answer on June 7, 2026 at 12:59 am

    You need a colon after your if test, and you need to indent the if taken clause:

    if bl[4][c]!='HST_10775_64_ACS_WFC_F814W_F606W':
        print bl[0][c] 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to create a csv file of some data. I have wrote
I have a text file which I intend to convert to a CSV (in
I have the following code - private static void convert() { string csv =
I have the following ERD and want to convert it EF 4.1 Code First
I am trying to convert this C code I have into a python script
I have some code that first selects an option value in a dropdown menu
I have a simple code in Entity Framework (EF) v4.1 code first: PasmISOContext db
I have several Entity Framework Code First DbContext objects that use a custom Initializer.
I have an Entity in Code First Entity framework that currently looks like this:
I have code like that 010200345 i want split every first three digit please

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.