Create your first script. t's a page spider designed to read a text file containing URLs, then read the HTML from those URLs and then to extract the text, but not the script, HTML or styling tag contents. Later you'll be saving this data to a SQLite database. You'll start by creating a stub script which has the method names but no real features beyond printing out the command line arguments that are passed into the script.
- [Instructor] We've set up our project,…and created our virtual environment,…but there's nothing in it, it's an empty project.…Let's add our very first script,…I'm going to right click,…on the project folder and select new and then Python file.…And I'm going to call my Python file page underscore spider.…I'll leave the kind set to Python file, and I'll select OK.…From here I'll start typing code.…I'll start with an import statement.…In this case I know I'm going to need os.…
And I know I'm going to need argparse.…I'll create a main method, which takes two arguments.…A database string which is going to be…a path to a database file.…And another path to a list of files,…that are going to contain the URLs…that our page spider is going to read.…I'll go ahead and set those both up as strings.…And for now I'll just put some print statements in here.…
Again if you are used to working in Python two,…the print statement in Python three is slightly different.…I'll just say we are going to work with,…and I'll just mirror out whatever you pass in for database.…
AuthorBruce Van Horn
- Installing the PyCharm, Git, and Pypy packages
- Adding functions
- Refactoring code
- Calling packages
- Debugging code
- Creating databases
- Working with in-line SQL
- Creating web projects with PyCharm
Skill Level Beginner
1. First Steps with PyCharm
2. Code Quality
3. Working with Databases
4. Web Projects
Odds and ends5m 42s
Next steps1m 42s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.