0. Similar to queue structure row, where the first person in the restaurant can take out the first data, why use the opposite queue in the same FIFO (First-In, First-Out) or LILO (Last-In, Last-Out) way as the first person in the restaurant to enter the restaurant?It is often used in operating systems and Internet networking functions.It is often used in operating systems to implement process scheduling methods for multitasking.There are no special advantages or disadvantages of cue, so it is better to understand the process scheduling method together as an example of utilization.[How to use the queue library]
import queuedata_queue = queue.Queue() # FIFO 정책 디폴트.put.get().qsize
import queuedata_queue = queue.Queue() # FIFO 정책 디폴트.put.get().qsize
queue.LifoQueue()queue.PriorityQueue().put(Priority, Data))
queue.LifoQueue()queue.PriorityQueue().put(Priority, Data))
queue_list = list “defenqueue(data): queue_list.def queue(data) def queue(): data = queue_list[0] del queue_list[0] range(10): enqueue(index)len(defen_list)dequeue()
queue_list = list “defenqueue(data): queue_list.def queue(data) def queue(): data = queue_list[0] del queue_list[0] range(10): enqueue(index)len(defen_list)dequeue()
queue_list = list “defenqueue(data): queue_list.def queue(data) def queue(): data = queue_list[0] del queue_list[0] range(10): enqueue(index)len(defen_list)dequeue()
ref. String function: capitalize, endwith, join, replace, split, sorted, reversedList function (del,.append: insert at the end, sort, reverse: directly transform vs reversed insert vs append, remove vs del: index vs pop, extend: extend value vs append: insert list itself, etc.) Tuple function once does not modify. It refers to the key value and customer account number that affect the program. ( in, not in, index, count, 등)Dictionary 함수(get, keys, values, items, in, not in)Set함수(intersection(&, 교집합), union(|, 합집합), difference(-, 차집합), add, remove)
ref. String function: capitalize, endwith, join, replace, split, sorted, reversedList function (del,.append: insert at the end, sort, reverse: directly transform vs reversed insert vs append, remove vs del: index vs pop, extend: extend value vs append: insert list itself, etc.) Tuple function once does not modify. It refers to the key value and customer account number that affect the program. ( in, not in, index, count, 등)Dictionary 함수(get, keys, values, items, in, not in)Set함수(intersection(&, 교집합), union(|, 합집합), difference(-, 차집합), add, remove)# The list 함MMethoddescriptionappend()dds element removes all elements from clear() at the end of the list.list copy() returns a copy of the list count() and returns the number of extended()dd elements specified. index (returns the index of the first element of the specified value) insert()dds pop the element of the specified position. remove the item of the specified value# The list 함MMethoddescriptionappend()dds element removes all elements from clear() at the end of the list.list copy() returns a copy of the list count() and returns the number of extended()dd elements specified. index (returns the index of the first element of the specified value) insert()dds pop the element of the specified position. remove the item of the specified value# Tuple 함MMethod descriptioncount() returns the number of times the specified value occurred in tupleindex(), searches for the specified value by tuple, and returns the location where it was found# Tuple 함MMethod descriptioncount() returns the number of times the specified value occurred in tupleindex(), searches for the specified value by tuple, and returns the location where it was found# Tuple 함MMethod descriptioncount() returns the number of times the specified value occurred in tupleindex(), searches for the specified value by tuple, and returns the location where it was found# Remove all elements of the set 함etMethoddescriptionadd()dds element from setclear(). setcopy() returns a copy of setdifferences() and removes the set containing the difference between two or more setdifferences_update(), specified set discard()move the specified item intersection() returns a set.That is, the other two sets of intersection_update() will remove items from this set that do not exist, and the specified set(s) will return whether the two sets have intersections. Returns whether the two sets contain this set. Returns whether another set contains this set. Returns whether this set contains another set. Returns whether this set contains another set. Remove the element from remove(). The specified element symmetric_difference() returns a set with two symmetry differences setsymmetric_difference_update()nserts explains the symmetrical difference from this set, and another union() updates the set with a combination of setsupdate# Remove all elements of the set 함etMethoddescriptionadd()dds element from setclear(). setcopy() returns a copy of setdifferences() and removes the set containing the difference between two or more setdifferences_update(), specified set discard()move the specified item intersection() returns a set.That is, the other two sets of intersection_update() will remove items from this set that do not exist, and the specified set(s) will return whether the two sets have intersections. Returns whether the two sets contain this set. Returns whether another set contains this set. Returns whether this set contains another set. Returns whether this set contains another set. Remove the element from remove(). The specified element symmetric_difference() returns a set with two symmetry differences setsymmetric_difference_update()nserts explains the symmetrical difference from this set, and another union() updates the set with a combination of setsupdate# dictionary 함MMethod description clear() removes all elements from dictionarycopy(). keys() returns a dictionary with the specified key, and valueget() returns the value of the specified key item. keys() returns a list containing tuples for each key value pair keys() keyspop()move the element with specified keypopitem()move the least inserted key-value pairset default() は、指定したキーの値を返します. If the key does not exist: Insert the key and return a list of all values in the dictionary by key-value pairs values() with the specified value update()# dictionary 함MMethod description clear() removes all elements from dictionarycopy(). keys() returns a dictionary with the specified key, and valueget() returns the value of the specified key item. keys() returns a list containing tuples for each key value pair keys() keyspop()move the element with specified keypopitem()move the least inserted key-value pairset default() は、指定したキーの値を返します. If the key does not exist: Insert the key and return a list of all values in the dictionary by key-value pairs values() with the specified value update()