python commands Flashcards

1
Q

pop function

.pop

var1.pop(var2)

.pop(var1)

A

Removes and returns an object from a list.

Calls the pop function.

from container var1, run pop function on var2
OR
Call pop function on parameter var2 which is in container var1

Call pop function on var1

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

.split

split function

A

Calls the split function.

Makes each word in string a separate piece(objects/strings) of data, basically turns strings into lists.

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

.append

append function

A

Calls the append function.

Adds to the end of a list.

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

.join

join function

A

Calls the join function.

Joins all objects together from a list.

i.e. print ‘ ‘.join(chris)
will print: bread butter scones jam tea coffee
joins a specified range of objects together from a list
i.e. print ‘ and ‘.join(chris[3:6])
will print: jam and tea and coffee

chris [bread butter scones jam tea coffee].

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

.exist

exist function

A

Calls the exist function.

Checks to see if a file/module exists and returns True if yes or False if no.

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

.open

open function

A

Calls the open function.

Opens a file/module.

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

.close

close function

A

Calls the close function.

Saves and closes a file/module.

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

.read

A

Calls the read function.

Reads the contents of a file.

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

.readline

deadline function

A

Calls the readline function.

Reads a specific line of file contents.

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

.truncate

truncate function

A

Calls the truncate function.

Deletes all data in a file.

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

.write

write function

A

Calls the write function.

Write to a file. overwrites existing data.

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

.items

item function

A

Calls the items function.

Retrieves data associated with variables or whatever it is called on.

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

.get

get function

A

Calls the get function.

Safely retrieves data that may or may not be there.

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

.key

A

?

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