Python Fundamentals

Opening the Project and Python File

Python Fundamentals

Check out a free preview of the full Python Fundamentals course

The "Opening the Project and Python File" Lesson is part of the full, Python Fundamentals course featured in this preview video. Here's what you'd learn in this lesson:

Nina demonstrates how to set up a basic file structure, create a python file, and a few handy keyboard shortcuts for VSCode.


Transcript from the "Opening the Project and Python File" Lesson

>> Nina Zakharenko: Let's open up our first project, let's change to our home directory, for Windows that's cd space $home. And then enter the Py workshop folder from the last step, the directory that you just created. We're gonna activate our virtual environment, should already be activated. Now we're gonna open a project from VS code in the command line.

So from that project directory we're gonna type code space dot, this should open the project in the current directory. And this is the last time we're gonna be using the terminal outside of VS code for the duration of the course. Now if for some reason this isn't working for you or you're getting a permission denied error or something like that, you can just open VS code from wherever you installed it.

Just double-click on the application and then navigate to File, Open, and open this PyWorkshop folder. So there are two really important keyboard shortcuts that you'll need to remember for VS code and that's it. If you have Notepad open or a piece of paper, I recommend just writing them down so you have them handy, the command palate.

So on Mac, that's command shift p, on Windows, control shift p. This is just your map to VS code, you can type any command in here and it will just easily narrow it down. Anything that you might wanna do, you'll find from the command palate. The next is the open file dialog, on Mac, that's command P, on Windows, it's Ctrl P, and that will easily let you open any file in your project.

And as you type it'll narrow things down.
>> Nina Zakharenko: So that's the basics of VS code, a little bit about working with Python. Where the first time that we open a Python file in VS code, we're gonna get some configuration pop ups. For the time being, make sure that you don't dismiss them cuz we're going to take action for them.

So let's make a new file called in the Py Workshop directory.
>> Nina Zakharenko: And if we wanted to do that from VS Code, there is a built in terminal. I know this via the keyboard shortcuts, on Mac it's CTRL + backtick and on Windows it's CTRL + single quote.

So that should drop you into the py workshop directory right here in the terminal. And on Mac, we can just say touch, and that'll make a new Python file here.
>> Nina Zakharenko: Or you can make a new file via this top left icon here, that's your explorer. You can just select the right folder and then hit this new file button.

Learn Straight from the Experts Who Shape the Modern Web

  • In-depth Courses
  • Industry Leading Experts
  • Learning Paths
  • Live Interactive Workshops
Get Unlimited Access Now