page_source method is used retrieve the page source of the webpage the user is currently accessing. The main use of this method to find something in the page source like finding any data or keyword.
Page source : The source code/page source is the programming behind any webpage.
It takes no argument.
Return value :
It return the page source in string format.
Output : This code will print the source code of the “https://www.geeksforgeeks.org/”.
Code 2. When no web page is opened.
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.