2.2.3(b) File handling Flashcards

1
Q

open =

A

= open(…)
eg. myFile = open(“sample.txt”)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

close =

A

= .close()
eg. myFile.close()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

read line =

A

= .readLine()
eg. myFile.readLine()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

write line=

A

= .writeLine()
eg. myFile.writeLine(“Add new line”)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

end of file =

A

= .endOfFile()
eg. while NOT myFile.endOfFile()
print (myFile.readLine())
endwhile

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

create a new file =

A

= newFile()
eg. newFile(“myText.txt”)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly