편집 기록

편집 기록
  • 프로필 doodoji님의 편집
    날짜2019.07.24

    syntax error 해결하기


    # -*- coding: utf-8 -*-
    from urllib.request import urlopen, Request
    import urllib
    import bs4
    
    location = '장기동'
    enc_location = urllib.parse.quote(location + '+날씨')
    
    url = 'https://search.naver.com/search.naver?ie=utf8&query='+ enc_location
    
    req = Request(url)
    page = urlopen(req)
    html = page.read()
    soup = bs4.BeautifulSoup(html,'html5lib')
    print('현재 ' + location + ' 미세먼지는 ' + soup.find('dd', class='lv1').find('span', class='num').text + '입니다.')
    

    File "", line 15 print('현재 ' + location + ' 미세먼지는 ' + soup.find('dd', class="lv1").find('span', class="num").text + '입니다.') ^ SyntaxError: invalid syntax

    왜 syntax가 뜨는지 도저히 모르겠습니다

  • 프로필 알 수 없는 사용자님의 편집
    날짜2019.07.24

    syntax error 해결하기


    -- coding: utf-8 --

    from urllib.request import urlopen, Request import urllib import bs4

    location = '장기동' enc_location = urllib.parse.quote(location + '+날씨')

    url = 'https://search.naver.com/search.naver?ie=utf8&query='+ enc_location

    req = Request(url) page = urlopen(req) html = page.read() soup = bs4.BeautifulSoup(html,'html5lib') print('현재 ' + location + ' 미세먼지는 ' + soup.find('dd', class='lv1').find('span', class='num').text + '입니다.')


    File "", line 15 print('현재 ' + location + ' 미세먼지는 ' + soup.find('dd', class="lv1").find('span', class="num").text + '입니다.') ^ SyntaxError: invalid syntax

    왜 syntax가 뜨는지 도저히 모르겠습니다