Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I have a problem with my python code can you fix it, please!! Here is the picture shown where is the problem: and here is

I have a problem with my python code can you fix it, please!!

Here is the picture shown where is the problem:

image text in transcribed

and here is the code:

from io import StringIO import pandas as pd import csv from simplecrypt import encrypt, decrypt from getpass import getpass

def EncryptCsv(a): with open(a,"r") as csvfile: #pass do something with file abc.csv f = csvfile.read() ciphertext = encrypt('USERPASSWORD',f.encode('utf8')) e = open('abc.enc','wb') # abc.enc doesn't need to exist, python will create it e.write(ciphertext) e.close filename2 = "abc.enc" def DecryptCsv(a): with open(a,"rb") as encryptedfile encryptedfile.read() print('Please enter the password and press the enter key Decryption may take some time')

# Decrypts the data, requires a user-input password CSVplaintext = decrypt(getpass("password: "), f).decode('utf8') print('Data have been Decrypted')

#create a temp csv-like file to pass to pandas.read_csv() DATA=StringIO(CSVplaintext)

# Makes a panda dataframe with the data df = pd.read_csv(DATA) df.to_csv('test_decrypted.csv', encoding='utf-8', index=False) #Driver code for Encryption filename1 = "abc.csv" EncryptCsv(filename1)

#Driver code for Decryption filename2 = "abc.enc" #the encrypted file that needs to be changed into a csv file #Output after decrypting abc.enc would give the decrypted csv - test_decrypted.csv DecryptCsv(filename2)

Command Prompt icrosoft Windows [Uersion 6.3.96001 (c> 2013 Microsoft Corporation. All rights reserved CNUsers sameercd CUsers sameerDesktop Users sameer\Desktop>python py File "CUsers sameer Desktop python.py". line 10 - csufile.read IndentationErro: expected an indented block Users sameer\Desktop>

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Harness The Power Of Big Data The IBM Big Data Platform

Authors: Paul Zikopoulos, David Corrigan James Giles Thomas Deutsch Krishnan Parasuraman Dirk DeRoos Paul Zikopoulos

1st Edition

0071808183, 9780071808187

More Books

Students also viewed these Databases questions

Question

What are the three main components of the cash budget?

Answered: 1 week ago

Question

Python function for printing a box of stars with dimensions

Answered: 1 week ago

Question

Write the difference between sexual and asexual reproduction.

Answered: 1 week ago

Question

What your favourite topic in mathematics?

Answered: 1 week ago

Question

Briefly describe vegetative reproduction in plants.

Answered: 1 week ago