dir.by  
Поиск >>

Компьютер, программы
→
Python
 Создаем новое приложение с Python в Visual Studio Code. Отладка приложения. Смотрим в отладке как по шагам выполняется Python 
посмотрели 7581 раз
обновлено: 7 February 2021
Step 1. Open Visual Studio Code
Если у вас не установлена Visual Studio Code нужно установить Visual Studio Code ...

Открываем Visual Studio Code
Step 2. Create a new folder my_python_project1 on disk D: and in the Visual Studio Code select this folder
Создаем новую папку my_python_project1 на диске D: и
в Visual Studio Code нажимаем
File → Open Folder ...
и выбираем эту папку D:/my_python_project1
Step 3. Create a new file main.py inside Visual Studio Code
Добавим код в
  file D:/My/my.html
print("Hello, world!")
Save the file for this click File → Save
Step 4. Run the project in the debugger to do this click Run → Start Debugging (key F5)
Выбираем "Python File" (то есть запустить текущий Python файл)
Увидим что текст "Hello, world!" отобразился внизу
На заметку 1. Создаем launch.json (выбираем путь к запускаемому файлу)
В параметре program write the path to the file to be launched у меня это файл main.py
На заметку 2. Если нету, то установим Python debugger
На заметку 3. We set stopping points (Breakpoints)
Let's put breakpoints in the file main.py
Breakpoints are set by pressing a key F9

Run the project in the debugger to do this click Run → Start Debugging (key F5) и увидим значения переменных
Скачать пример
my_python_project1.zip ...
размер: 1 kb
Структура файлов:
D:/my_react_example1
        main.py
        .vscode
                launch.json            файл настройки для Visual Studio Code (путь к запускаемому файлу)
 
Как запустить пример?
1) Открываем Visual Studio Code
2) В Visual Studio Code нажимаем в меню File → Open Folder выбираем папку где распокавали проект
3) Click Run → Run Debugging или кнопку F5
 
← Previous topic
Create a new Python application in a text editor and run it on the command line
 
Next topic →
How do you check in Python if an object has an attribute?
 
Your feedback ... Comments ...
   
Your Name
Your comment (www links can only be added by a logged-in user)

 
• Download and install Python for Windows
New app
Option 1. Create a new application in a text editor and run it on the command line
• Create a new Python application in a text editor and run it on the command line
Option 2 (the best for me). Creating a New App in Visual Studio Code
• Creating a new application with Python in Visual Studio Code. Debugging the application. See how Python is executed step by step in debugging
Python syntax, functions, classes
• How do you check in Python if an object has an attribute?
Examples
• Python example: "Open the XML file and read the sections and save it to the txt file"
• Python example: "Download tasks from Redmine"
• Python example: "HTTP server"
Sites to learn Python
• Sites to learn Python

  Ваши вопросы присылайте по почте: info@dir.by