The logic of the for loop in the python return return value

the code is as follows:

self._os_bond_path = "/proc/net/bonding/*"

def __get_os_bonding(self):
    return list(set([b.split("/")[-1] for b in glob.glob(self._os_bond_path)]))
    

ask the expert to give us some advice on the logic and content of the value of this function. Thank you very much.

Mar.23,2021

 

first glob.glob (self._os_bond_path) this is a list of all files to see the usage of glob in detail

the list above in the

loop gets b and then split b to'/ 'cut out the last bit (which should be the file name and file type)

deduplicates all the resulting files by set and returns
by putting them in the list. The final result is all the deduplicated file names of / proc/net/bonding/ in this directory (all in the list)

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3a756-e765.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3a756-e765.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?