Adding Content to a File
So far, you have created a Python file, but there is nothing in it. So next I want you, without opening any external editor, create some content in this file, Like a
print("Hello, Terminal!") function. Okay.
Right. If I started doing stuff like this, you can see with the syntax highlighting that it’s getting a bit confused, and it’s printing—
echo just means print this to the terminal, as you can see it’s done here, but it’s done in a bit of a weird way.
01:07 And it’s basically similar to how it works with strings in Python. Right. If you want to have a quotation mark inside of a string, you have to use the other quotation mark, basically. Yeah. Yeah, absolutely.
Okay, so now the terminal itself didn’t output anything because you redirected this
echo command into the file. Right, yes. I was hesitant of how much detail to go into with this because, again, it’s not something I usually do—use this redirect chevron—because it sort of redirects the output of this first command into wherever I want. I could redirect it into another command or into a file, for instance, like I have here.
Become a Member to join the conversation.