class Main():
def __init__(self):
def placeName(self):
place_name = raw_input("\n=> Enter a place name: ")
placename_data = place_name.strip()
if re.match("^[a-zA-Z]*$", placename_data):
return placename_data
else:
print("Error! Only Alphabets from are allowed as input!")
a = Main()
new = a.placeName()
Above code for placeName() method runs correctly without using class but when I try to add it in a class, code gives an attribute error . Can't understand what is wrong here.