Improve paths lesson
This commit is contained in:
parent
e0bde44953
commit
4df28edaf0
@ -7,26 +7,19 @@ func main():
|
|||||||
|
|
||||||
path := (/tmp/test-file.txt)
|
path := (/tmp/test-file.txt)
|
||||||
>> path
|
>> path
|
||||||
= /tmp/test-file.txt
|
= (/tmp/test-file.txt)
|
||||||
|
|
||||||
path:write("first line")
|
path:write("first")
|
||||||
>> path:read()
|
>> path:read()
|
||||||
= "???"
|
= "???"
|
||||||
|
|
||||||
path:append("
|
path:append(",second")
|
||||||
|
|
||||||
second line
|
|
||||||
")
|
|
||||||
|
|
||||||
>> path:exists()
|
>> path:exists()
|
||||||
= yes
|
= yes
|
||||||
|
|
||||||
# You can iterate over a file by lines:
|
|
||||||
>> upper_lines := [line:upper() for line in path:by_line()!]
|
|
||||||
= [???]
|
|
||||||
|
|
||||||
>> path:parent()
|
>> path:parent()
|
||||||
= /???
|
= (/???)
|
||||||
|
|
||||||
>> path:extension()
|
>> path:extension()
|
||||||
= "???"
|
= "???"
|
||||||
|
Loading…
Reference in New Issue
Block a user