Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

This lesson is for members only. Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Hint: You can adjust the default video playback speed in your account settings.
Hint: You can set your subtitle preferences in your account settings.
Sorry! Looks like there’s an issue with video playback 🙁 This might be due to a temporary outage or because of a configuration issue with your browser. Please see our video player troubleshooting guide to resolve the issue.

Creating a File

00:00 Perfect. So, you created a folder now. Next, I want you to create a file, and I think we name it So we make a Python file.

00:12 Okay, so I used the touch command to create a file. Again, I don’t get any feedback, but I can always check what’s in my folder by typing ls to list the contents.

00:25 And now, after creating this file using touch and then the name of the file, here it is:

00:32 And with the touch command, you’re creating an an empty file. You could also create a text file or a Markdown file. And for now, it’s just a blank file that has a .py ending.

00:45 And yeah, to really make it a Python file, let’s put some Python code in it. Maybe a print("Hello, Terminal!").

00:53 Sure. Before I do this, I’m going to do a different command to just clear the screen, which is just clear. And that brings me back up to the top, so it’s a bit easier to see what I’m typing. So, nothing happened here.

01:04 If I scroll, you can still see, like, everything’s still there. It really just moves the screen to the top so that you have more space to type and see what you’re typing. Cool. Perfect. That’s handy. Yeah.

01:15 Your task was to add print("Hello, Terminal!") into this file, right? So my file is still here, and then I will say echo,

01:25 then I need to use the right quotes: 'print("Hello Terminal"And there’s, do you want the comma in there? Sure. Maybe let’s put a comma in there. Let’s be correct. Exclamation mark. Okay.

01:39 I said I have to use the right quotes. That’s just because I want to use double quotes in here in the string for Python. I could also swap this around, so I could use double quotes out here and then single quotes inside. Perfect.

01:52 So that’s basically like within Python code as well, that you have to be cautious of your quotation marks. And if I just ran this like that, actually—well, I’m going to take a little detour, sorry, Philipp. No, go for it. This is just going to print it out, you see? Like, if I say echo, it’s a command.

02:08 It’s kind of like the print command in Python. So it prints it to the terminal. So this didn’t put it into the file, but if I say give me this output, whatever I put inside of the quotes here—so for me, this is print("Hello, Terminal!")

02:23 and then I want to put it inside of a file. For this, I can use this symbol (>) that’s the greater than symbol, I think. Greater than, yeah.

02:31 And then give the filename then where I want to put it. So I say, and then press Enter.

Become a Member to join the conversation.