Search code examples
pythonvisual-studio-codesyntax-errorpylintopencsv

Invalid syntax showing up in pylint


This python code showing this invalid syntax (, line 16) pylint(syntax-error)[15,10] here error showing at semicolon(:)

for record in colleges:
    obj.writerow([record['collegeId'], record['collegeName'], record['courseType'], record['city'], record['fees'], record['pinCode']])

Solution

  • Assuming obj is a csv.Writer. Even still, you only seem to be missing a colon?

    for record in colleges:
        obj.writerow([
            record['collegeId'],
            record['collegeName'],
            record['courseType'],
            record['city'],
            record['fees'],
            record['pinCode']
        ])