강의

멘토링

커뮤니티

Cộng đồng Hỏi & Đáp của Inflearn

Hình ảnh hồ sơ của wsdq11058761
wsdq11058761

câu hỏi đã được viết

Bắt đầu lập trình: Giới thiệu về Python (Inflearn Original)

Chức năng bên ngoài(2-2)

webbroswer 질문

Viết

·

357

0

 안녕하세요 영상에 나온대로 webbrowser 코드를 그대로 작성했으나 실행이 되질 않습니다. 근데 밑 코드에 추가로 time.sleep을 넣어주면 또 실행이 돼요. 이유가 무엇인지 궁금합니다.


import webbrowser 
webbrowser.open('https://www.naver.com/')


python

Câu trả lời 2

0

niceman님의 프로필 이미지
niceman
Người chia sẻ kiến thức

안녕하세요.

이상하네요. sleep 이 없어도 실행이 되야 하는데 해당 브라우저 실행 권한이나, 다른 이유가 있는 것으로 보여요

소스상에 문제가 없으면 환경을 바꿔서 해봐야 될 것 같습니다.(다른 pc 등)

webbrowser.open(url, new=0, autoraise=True)

Display url using the default browser. If new is 0, the url is opened in the same browser window if possible. If new is 1, a new browser window is opened if possible. If new is 2, a new browser page (“tab”) is opened if possible. If autoraise is True, the window is raised if possible (note that under many window managers this will occur regardless of the setting of this variable).

Note that on some platforms, trying to open a filename using this function, may work and start the operating system’s associated program. However, this is neither supported nor portable.

Raises an auditing event webbrowser.open with argument url.

webbrowser.open_new(url)

Open url in a new window of the default browser, if possible, otherwise, open url in the only browser window.

0

wsdq11058761님의 프로필 이미지
wsdq11058761
Người đặt câu hỏi

추가로 전 open과 open_new의 실행결과 차이가 전혀 없는데 왜 그럴까용,,

Hình ảnh hồ sơ của wsdq11058761
wsdq11058761

câu hỏi đã được viết

Đặt câu hỏi