Question: Q4(25p). The following Python code has some errors, debug it and upload the complete working code in your response in Blackboard. Add comments in the

 Q4(25p). The following Python code has some errors, debug it and

Q4(25p). The following Python code has some errors, debug it and upload the complete working code in your response in Blackboard. Add comments in the code describing how you repaired the code. If you don't add comments, your score will be reduced by half. The code is also available in Blackboard to make it easy for copy & paste The following code is supposed to create a socket connection, read the .txt file and write the content of the text file to a local file named "question4a.txt', but it receives errors. Debug the code: import socket import os mysock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) mysock.connect('gutenberg.org', 80)) cmd="GET www.gutenberg.org/cache/epub/28198/pg28198.txt HTTP/1.0 'encode() local_file = open('question4a'+'.txt', encoding="utf-8') while True: data = mysock.recv(512) if len(data)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!