Compare commits

...

3 Commits

  1. 20
      basics/strings.py
  2. 8
      web-scraping/basic-req.py
  3. 13
      web-scraping/download-web-page.py
  4. 4853
      web-scraping/files/RomeoAndJuli.txt
  5. 2
      web-scraping/open-web-site.py
  6. 23
      web-scraping/readme.md

20
basics/strings.py

@ -0,0 +1,20 @@
spam = "That is Alice's cat."
###############################################################################
# Escape Characters
# \' single quote
# \" double quote
# \\ backslash
# \n newline
# \t tab
###############################################################################
# Raw string prints everything literally
print(r"That is Alice\'s cat/n")
# Multiline strings
print("""
This is a multi-line string.
It is made up of three lines.
""")

8
web-scraping/basic-req.py

@ -0,0 +1,8 @@
import requests
res = requests.get('https://automatetheboringstuff.com/files/rj.txt')
print(type(res))
if res.status_code == requests.codes.ok:
print(len(res.text))
print(res.text[:250])

13
web-scraping/download-web-page.py

@ -0,0 +1,13 @@
import os
import requests
cwd = os.getcwd()
print('Current working directory is: ', cwd)
res = requests.get('https://automatetheboringstuff.com/files/rj.txt')
res.raise_for_status()
playFile = open(cwd + '\\web-scraping\\files\\RomeoAndJuli.txt', 'wb')
for chunk in res.iter_content(10000):
playFile.write(chunk)
playFile.close()

4853
web-scraping/files/RomeoAndJuli.txt

File diff suppressed because it is too large Load Diff

2
web-scraping/open-web-site.py

@ -0,0 +1,2 @@
import webbrowser
webbrowser.open('https://chat.harmonyhealthmedical.com')

23
web-scraping/readme.md

@ -0,0 +1,23 @@
# Required modules
## Requests module
The requests module is used to send HTTP requests.
- [Python 3.7](https://www.python.org/downloads/)
- [Requests](https://pypi.org/project/requests/)
```
pip install requests
```
## BeautifulSoup module
The Beautiful Soup Python library is used to parse HTML and XML documents.
- [BeautifulSoup4](https://pypi.org/project/beautifulsoup4/)
```
pip install beautifulsoup4
```
## Selenium module
The selenium module is used to automate web browsers.
- [Python 3.7](https://www.python.org/downloads/)
- [Selenium](https://pypi.org/project/selenium/)
Loading…
Cancel
Save