How to pass char** in python ctype?

How do you pass argument to functions in Python?

  • page = """ <div class="product-primarydata "> <p class="p product-price"> <span class="price-mrp"><del>Rs.100</del></span> <span class="price-fsp">Rs.58</span> </p> <div class="p"> <span class="rating-wrapper-big "> <span class="rating" style="width: 78%"></span> </span>1077 Ratings </div> """ def get_tag(self,start,end,page): start = page.find(start)+len(start) end = page[start:].find(end)+start return start,end first,last = get_tag('<span class="price-fsp">','</span>',page) but python shows: TypeError: get_tag() takes exactly 4 arguments (3 given) please find the error !!!!

  • Answer:

    Is get_tag function part of a class ?. If not then just remove self from the function definition i.e. def get_tag(start,end,page): If get_tag is part of a class. The create instance of the class and use the instance to invoke get_tag. for e.g. class Tagging(object):   def get_tag(self, start, end, page):     # your code     return tag aTag = Tagging() print aTag.get_tag() Also if you are new to python read up on Object Oriented Programming in Python to make sense of self keyword.

Ankur Gupta at Quora Visit the source

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.