3-1-5-6. Programming Environment Setup
you might like to see this setup to get some ideas.
Over here is a text editor.
This particular editor is called atom.
But there are many additional editors I recommend in the notes below.
A text editor is really different from a word processor,
so don’t mix them up.
Code needs to be written line-by-line with intentional line breaks and
indentations that fundamentally change how the code is read and run.
Good text editors have
simple but vital features such as line numbers and syntax highlighting.
You can see the different ways atom highlights a text based on
the types of words and objects it recognizes from the Python language.
Syntax highlighting really helps make code more readable and organized.
It can also prevent us from making some syntax errors.
For example, if I forgot a quote at the end of the string,
I’ll know I missed it when the rest of the line is highlighted like a string.
Atom knows to use syntax highlighting for
Python because of this.py at the end of the file name.
This tells atom it’s dealing with a Python file.
Editors are highly customizable to suit your style.
One setting that I use is soft tabs with the top length of four.
Which means that when I press tab it is converted into four spaces.
You can also add cool add-ons.
Like this Python linter,
that uses Pylint to point out helpful things in my code.
For example, in this line,
pylint gives me a warning because I’m not following
PEP 8 guidelines by including a space before my closing bracket.
I also have this cool add-on which let’s me use my terminal in my editor.
Atom isn’t the only thing on my screen right now.
I do use this terminal add-on from time to time but
generally I like to have a separate window for my terminal where I can run my scripts.
Generally, I can’t write a whole lot of code in one go because
something will go wrong and I’ll need to find the issue and debug it.
When there’s an error it will show up here when I run the script.
I make small changes to the code in
a text editor and then run the script again to see the output.
If I see a problem I’ll try to fix it or if things seem to be working I’ll move on.
I’ve also got the Udacity classroom and results from a question I googled in my browser.
Normally, I’ll need a browser open to look up documentation
or search for the solution to a bug I encounter along the way.
From now on, we recommend that you try out all your code in this way.
Put code into a new file in your text editor and don’t forget the.py extension.
Make sure you’re in the correct directory in your terminal and then run your script.
설정하는 방법은 여러 가지가 있습니다
프로그래밍 환경에 대해 옳고 그른 방법은 없습니다.
그러나 Python으로 프로그래밍을 막 시작하는 경우
아이디어를 얻기 위해 이 설정을 보고 싶을 수도 있습니다.
여기 텍스트 편집기가 있습니다.
이 특정 편집기를 atom이라고 합니다.
그러나 아래 메모에서 내가 추천하는 추가 편집자가 많이 있습니다.
텍스트 편집기는 워드 프로세서와 정말 다릅니다.
그래서 그들을 섞지 마십시오.
코드는 의도적인 줄 바꿈을 사용하여 한 줄씩 작성해야 합니다.
코드를 읽고 실행하는 방식을 근본적으로 바꾸는 들여쓰기.
좋은 텍스트 편집기는
줄 번호 및 구문 강조와 같은 간단하지만 중요한 기능.
원자가 다음을 기반으로 텍스트를 강조 표시하는 다양한 방법을 볼 수 있습니다.
Python 언어에서 인식하는 단어 및 개체의 유형입니다.
구문 강조 표시는 코드를 더 읽기 쉽고 구성하는 데 실제로 도움이 됩니다.
또한 일부 구문 오류를 방지할 수 있습니다.
예를 들어 문자열 끝에 인용 부호를 잊어버린 경우
줄의 나머지 부분이 문자열처럼 강조 표시되면 놓쳤음을 알 수 있습니다.
Atom은 구문 강조 표시를 사용하는 것을 알고 있습니다.
파일 이름 끝에 this.py가 있기 때문에 Python.
이것은 원자에게 파이썬 파일을 다루고 있다는 것을 알려줍니다.
편집기는 스타일에 맞게 고도로 사용자 정의할 수 있습니다.
내가 사용하는 설정 중 하나는 상단 길이가 4인 부드러운 탭입니다.
즉, 탭을 누르면 4개의 공백으로 변환됩니다.
멋진 추가 기능을 추가할 수도 있습니다.
이 파이썬 린터처럼,
그것은 Pylint를 사용하여 내 코드에서 유용한 것들을 지적합니다.
예를 들어 이 줄에서
pylint는 내가 팔로우하지 않기 때문에 경고를 줍니다.
닫는 괄호 앞에 공백을 포함하여 PEP 8 지침.
또한 편집기에서 터미널을 사용할 수 있는 멋진 추가 기능이 있습니다.
지금 내 화면에는 Atom만 있는 것이 아닙니다.
나는 때때로 이 터미널 애드온을 사용하지만
일반적으로 나는 스크립트를 실행할 수 있는 별도의 터미널 창을 갖고 싶습니다.
일반적으로 한 번에 많은 코드를 작성할 수 없기 때문에
문제가 발생하여 문제를 찾아 디버깅해야 합니다.
오류가 있는 경우 스크립트를 실행할 때 여기에 표시됩니다.
코드를 약간 변경합니다.
텍스트 편집기를 실행한 다음 스크립트를 다시 실행하여 출력을 확인합니다.
문제가 보이면 수정하려고 하거나 일이 제대로 작동하는 것 같으면 계속 진행하겠습니다.
또한 Udacity 강의실과 브라우저에서 구글링한 질문의 결과를 얻었습니다.
일반적으로 문서를 조회하려면 브라우저를 열어야 합니다.
또는 도중에 만난 버그에 대한 솔루션을 검색하십시오.
이제부터는 이 방법으로 모든 코드를 시험해 볼 것을 권장합니다.
텍스트 편집기에서 새 파일에 코드를 넣고 .py 확장자를 잊지 마십시오.
터미널의 올바른 디렉토리에 있는지 확인한 다음 스크립트를 실행하십시오.
Configure Your Own Python Programming Setup
Now you’ve seen my setup, take a moment to get yourself comfortable on your own computer.
Below you will find a number of different options for code editors. We recommend for all of our courses using Atom, which will work on all operating systems. If you decide not to use Atom, for first time coders Sublime is also popular.
For Mac and Linux:
For Windows:
Get your screen set up with a text editor, terminal/command line and the Udacity classroom in a web browser, so you can iterate on your Python script. Play with the display options to see what you find most comfortable to look at, and see if you can find a tab-to-four-spaces option – that’ll be very useful for Python indentation.
댓글을 달려면 로그인해야 합니다.