Command/Functions Flashcards

1
Q

read()

A

displays text

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

close()

A

closes the file

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

readline

A

reads just one line

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

truncate()

A

empties the file

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

write(stuff)

A

writes “stuff” to the file

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

len()

A

returns the number of items of a sequence or mapping

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

raw_input(prompt)

A

recieves data from the user

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

range()

A

gets the values up to the final number (i.e. 1,6 gets 12345)

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

vars()

A

Without arguments, equivalent to locals()

With an argument, equivalent to object.__dict__

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

classmethod()

A
Convert a function to be a class method
It recieves the class as implicit first argument
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

filepoint.seek(int)

A

seek moves to a certain part of the file. Use with filepoint to reach a certain point, making “int” the number of bytes down the line. Default is 0.

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

return()

A

gives the value of a function. Return 1+2 = 3

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

super()

A

calls parent class then calls added functions in the child class

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

__init__(self,)

A

creates an empty object inside of a class

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

open()

A

opens file

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