Unit 3 Lesson 4 - File I/O - Intro to Coding in Python

Опубликовано: 28 Сентябрь 2024
на канале: Code Dog
105
2

In this video we learn how to interact with text files in Python.

If you got an error:
FileNotFoundError: No such file or directory: 'data.txt'
This is most likely because your text file and Python code are inside of a folder inside of your project folder in Visual Studio Code. For example, your code might be inside of a 'Unit 3' folder inside of your 'Intro to Coding' folder.

How to fix it:
• Open VS Code settings (you can get to that using the shortcut CMD/CTRL + comma ) → search for 'Python Terminal: Execute in Dir' → check this box.
• If using the Code Runner extension, search for ' Code-runner: File Directory As Cwd' → check that box. Then try to run your code again.

This video is part of the Intro to Coding course, a free and open-source curriculum available for all classrooms to use. Intro to Coding was designed to introduce more schools and students into the computer technology fields. For more information visit https://github.com/isaiahkahler/intro...