2021年3月4日星期四

Removing items in a python dictionary under a condition

Suppose I have this dictionary

{0: ['replaced scanner user properly working cage replaced wire damaged stored later use',    'replaced scanner'],   1: ['scanner replaced station working well'],   2: ['station scanner synced base station working'],   3: ['printer offlineswitched usb portprinter online working'],   4: ['replaced barcode label reflecting tcs ip address'],   5: ['restarted thin client using ssh run restart command'],   6: ['printer reconfigured test functioning normally', 'printer reconfigured'],   7: ['removed old printer service installed replacement tested good'],   8: ['tc required reboot rebooted tc aa signin dp functional'],   9: ['resetting printer factory settings reconfigure'],   10: ['updated windows forced update laptop operated normally'],   11: ['printer settings set correct printer working correctly'],   12: ['power printer disconnected reconnected working fine'],   13: ['power cycled equipment restocked spooler plastic bubbles'],   14: ['laptop checked ive logged paskiplacowepl without problem'],   15: ['reseated scanner cables connection usb port resolve issue'],   16: ['red scanner reconfigured base rebooted via usb joint'],   17: ['tested printer station connected working resolved'],   18: ['reconfigured printer media print properly'],   19: ['replaced defective device fresh imaged laptop'],   20: ['reconfigured scanner base tested aa fine'],   21: ['printer unplugged usb port working properly'],   22: ['reimaging laptop corrected anyconnect software issue'],   23: ['reconfigured scanner confirmed scans intended'],   24: ['reconnected usb cable reassign printer ports port'],   25: ['plugged usb cable port scanner works'],   26: ['cleared linux print queue working'],   27: ['user reset password successfully closing tt'],   28: ['reset printer get print'],   29: ['reconfigured hand scanner linked station'],   30: ['replaced scanner station functional', 'replaced scanner'],   31: ['laptops battery needed reset asset serial'],   32: ['printer reconfigured'],   33: ['upgraded rebooted station'],   34: ['deploying replacement scanner'],   35: ['replaced scanner'],   36: ['updated pc'],   37: ['tc reimage']}  

You can see that the key 0 and 35 have the same string. I would like to have 35 removed. How would I generalize this process in the best pythonic way?

https://stackoverflow.com/questions/66485023/removing-items-in-a-python-dictionary-under-a-condition March 05, 2021 at 08:28AM

没有评论:

发表评论