Back

Explore Courses Blog Tutorials Interview Questions

Explore Tech Questions and Answers

Welcome to Intellipaat Community. Get your technical queries answered by top developers!

0 votes
2 views
by (18.4k points)

In line number 9 of python code, I am getting a syntax error for the below code:

import hashlib, sys

m = hashlib.md5()

hash = ""

hash_file = raw_input("What is the file name in which the hash resides?  ")

wordlist = raw_input("What is your wordlist?  (Enter the file name)  ")

try:

    hashdocument = open(hash_file,"r")

except IOError:

    print "Invalid file."    # Syntax error: invalid syntax

    raw_input()

    sys.exit()

else:

    hash = hashdocument.readline()

    hash = hash.replace("\n","")

My version of Python is:

Python 3.2.2 (default, Sep  4 2011, 09:07:29) [MSC v.1500 64 bit (AMD64)] on win

32

1 Answer

0 votes
by (36.8k points)

In Python 3 version print id considered as a function so it needs to be inside the parathesis as shown below:

print("Hello World")

A similar problem was been solved hear

If you are a beginner and want to know more about Data Science the do check out the Data Science course

Related questions

Browse Categories

...