SyntaxError: invalid syntax if __name_=_main____



  • #! usr/bin python3
    
    import  urllib.request
    from bs4 import BeautifulSoup
    
    def get_html(url):
            response = urllib.request.urlopen()
            return response.read()
    
    def parse(html):
        soup = BeautifulSoup(html)
    
    def main():
        print(get_html('http://av.by/public/index.php?event=3&category_id=1864&show_new=0')
    
    if __name__ =  "__main__":
        main()
    

    Mistake

    File "avby.py", line 16
    

    if name = "main":
    ^
    SyntaxError: invalid syntax



  • In the programming language Python symbol = means Appropriationwhile the contingent operator awaits the result comparisons♪ In order to shoulder the error, a comparison operator should be used. Python recorded as ==

    P.S. And the bracket. printShut up!




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2