![]() ![]() We usually use a relative path, which indicates where the file is located relative to the location of the script (Python file) that is calling the open() function.įor example, the path in this function call: open("names.txt") # The relative path is "names.txt" The first parameter of the open() function is file, the absolute or relative path to the file that you are trying to work with. To learn more about them, please read this article in the documentation. There are six additional optional arguments. □ Tip: These are the two most commonly used arguments to call this function. One of the most important functions that you will need to use as you work with files in Python is open(), a built-in function that opens a file and allows your program to use it and work with it. Let's begin! ✨ □ Working with Files: Basic Syntax ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |