answers15
What are 4 commands provided by shutil? - ANSWERS-copyfile, copy, copytree, rmtree
What is the symlinks argument? - ANSWERS-An argument for copytree, decides whether to
copy symbolic links or actual files
How do you save things with pickle? - ANSWERS-pkl = pickle.Pickler(file); pkl.dump(something),
file.close()
How do you load pickled information? - ANSWERS-pickle.load(file)
How do you shelve a file? - ANSWERS-shelve.open(file)
What does CGI stand for? - ANSWERS-common gateway interface
How do you open a URL? - ANSWERS-urllib.request.urlopen(url)
How do you define a class? - ANSWERS-class Class:
how do we add a list to a list? - ANSWERS-list[2] = [1, 2, 3]
how do we ad elements of a list to a list? - ANSWERS-list[2:2] = [1,2,3]
, how do we delete elements from a list? - ANSWERS-del list[1]
what's another way of deleting elements from a list, besides del? - ANSWERS-list[1] = []
what does 3 * [0] return? - ANSWERS-[0,0,0]
if you really want to copy a list, what can you do? - ANSWERS-list2 = list1[:]
difference between append and extend? - ANSWERS-append adds whole argument as single
element, while extend adds each item of argument as element
how to insert exactly one element? - ANSWERS-list.insert(position, element)
what does remove do to a list? - ANSWERS-removes first element in list with given value
what does list.sort() do? - ANSWERS-
what does list.index() do? - ANSWERS-
what does list.count() do? - ANSWERS-
what does dict.get(key) return if the key exists? - ANSWERS-the value of the key
what does dict.get(key) return if the key does not exist? - ANSWERS-None
what kind of objects do dictionary methods return? - ANSWERS-view