In Python, we are used to using bisect to search for elements in the List. In Go, sort.Search() can also provide us with the same purpose. As in Python, the target array is sorted before searching.
1 2 arr := []int{9, 2, 1, 3, 6, 4, 5, 5} sort. Ints(arr) After sorting, we use sort.Search(), the first parameter is the search target, and the second is the function of the search condition.
Sometimes I upload videos for my family but don’t know if they already exist on the computer. At this time, I can think of a way to automatically email the titles of the videos already in the video library to myself for reference on a regular basis.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 ~/Downloads ➤ cat 2021-12-03-movie_list.txt -r :10 ───────┬──────────────────────────────────────────────────────────────────────────────────────────────── │ File: 2021-12-03-movie_list.