INFO1110 Lecture Notes - Lecture 4: Working Directory, Root Directory, Order Of Merit

8 views1 pages

Document Summary

Lomoarcpsd|7290020: absolute path (from root directory, \, relative path (relative destination from current working directory) When you open a le for reading (read mode), the program assumes the le exists and you have permission to read from the le. When you open a le for writing (write mode), you always begin with an empty le: if le already exists, program will override, if le does not exist, program will create it. To add to the end of an existing le, you will want to append (append mode). The following code writes the string contents to a le called sample. txt. After running the below command in your terminal, you should be able to see a new le with the ls command. We use the open function to open a le. The open function takes a lepath as its rst argument and a mode as the second argu- ment.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents