2017-01-13 47 views
0

我想從2文件python從打印resrc_lst[i]從json文件和line.split(' ' ,2)[2]從文本文件拆分字符串中找到重複的字符串。這是我的代碼。我找不到重複的字符串與python

for i in range(len(resrc_lst)): 
    print(resrc_lst[i]) 

    if(resrc_lst[i] != ""): 

     with open("clicker_out.txt", "r", encoding="utf8") as search_lst: 
      for line in search_lst: 

       if resrc_lst[i].strip() in line.split(' ' ,2)[2]: 
        print(line.split(' ' ,2)[2]) 

我敢肯定,2個文件都有重複的字符串,當我運行代碼時,它顯示這樣。

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NetSh 
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NetSh\4 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NetSh\nshhttp 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NetSh\(Default) 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NetSh\wshelper 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NetSh\wwancfg 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NetSh\p2pnetsh 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NetSh\hnetmon 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NetSh\nettrace 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NetSh\rpc 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NetSh\wlancfg 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NetSh\nshipsec 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NetSh\whhelper 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NetSh\netiohlp 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NetSh\napmontr 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NetSh\WcnNetsh 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NetSh\dot3cfg 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NetSh 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NetSh\fwcfg 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NetSh\authfwcfg 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NetSh\nshwfp 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NetSh\2 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NetSh\dhcpclient 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NetSh\(Default) 
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NetSh\(Default) 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion 
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\PeerDist\Roaming\RefreshProcName 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\PeerDist\HandleMgr 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\PeerDist\Service\Enable 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\PeerDist\HostedCache\TransportDllPath 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\PeerDist\DownloadManager\CryptoAlgo 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\PeerDist\Roaming 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\PeerDist\HostedCache\MaxPendingDownloads 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\PeerDist\Service\PolicyRefreshInProgress 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\PeerDist\CacheMgr\Publication 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\PeerDist\SecurityManager 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\PeerDist\HostedCache\MaxSimultaneousDownloads 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\PeerDist\SecurityManager\BlockSize 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\PeerDist\HostedCache 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\PeerDist\CooperativeCaching 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\CurrentBuildNumber 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\PeerDist\DiscoveryManager 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\PeerDist\Publisher 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\PeerDist\HostedCache\MaxPendingOffers 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\UserenvDebugLevel 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\PeerDist\HostedCache\MaxSimultaneousUploads 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\PeerDist\SecurityManager\Restricted\Seed 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\PeerDist\DownloadManager\Download 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\PeerDist\CacheMgr\Republication 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\PeerDist\HostedCache\Connection 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\PeerDist\SecurityManager\Restricted 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\PeerDist\Roaming\RefreshDllName 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\PeerDist\HostedCache\ServerRole 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\PeerDist\DownloadManager\Protocol 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\PeerDist\DiscoveryManager\DiscoveryProviderDllPath 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\PeerDist\DiscoveryManager\MinBackoffWindow 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\PeerDist\HostedCache\DoNotUseSSL 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\PeerDist\HostedCache\ClientAuth 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\PeerDist\DownloadManager\Peers\Connection 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\PeerDist\DownloadManager\TransportDllPath 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\PeerDist\Service 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\PeerDist\DownloadManager\Discovery 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\PeerDist\PolicyProvider 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\PeerDist\DownloadManager\Upload 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\PeerDist\DownloadManager 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\PeerDist\SecurityManager\NumBlocksPerSegment 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\PeerDist\DownloadManager\UtilityIndex 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\PeerDist\Roaming\ForceRoamingDetect 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\PeerDist\DiscoveryManager\RepubQuorumSize 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\CurrentBuildNumber 
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\CurrentBuildNumber 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NetSh\4 
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NetSh\4 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NetSh\nshwfp 
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NetSh\nshwfp 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NetSh\dhcpclient 
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NetSh\dhcpclient 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NetSh\wshelper 
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NetSh\wshelper 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NetSh\nshhttp 
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NetSh\nshhttp 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NetSh\fwcfg 
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NetSh\fwcfg 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NetSh\authfwcfg 
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NetSh\authfwcfg 

C:\Windows\system32 
C:\Windows\system32 

HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Setup 
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Setup 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup\SourcePath 
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Setup\SourcePath 

HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion 
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion 

HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Setup 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\DevicePath 
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\DevicePath 

HKEY_LOCAL_MACHINE\System\Setup 
HKEY_LOCAL_MACHINE\System\Setup 

HKEY_LOCAL_MACHINE\SYSTEM\Setup\Upgrade 
HKEY_LOCAL_MACHINE\SYSTEM\Setup\Upgrade 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NetSh\2 
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NetSh\2 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NetSh\netiohlp 
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NetSh\netiohlp 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NetSh\whhelper 
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NetSh\whhelper 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NetSh\hnetmon 
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NetSh\hnetmon 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NetSh\rpc 
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NetSh\rpc 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NetSh\dot3cfg 
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NetSh\dot3cfg 

HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\LDAP 
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\LDAP 

HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\ldap\LdapClientIntegrity 
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\ldap\LdapClientIntegrity 

HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\LDAP 
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\LDAP 

HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\ldap\UseOldHostResolutionOrder 
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\ldap\UseOldHostResolutionOrder 

HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\LDAP 
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\LDAP 

HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\ldap\UseHostnameAsAlias 
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\ldap\UseHostnameAsAlias 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NetSh\napmontr 
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NetSh\napmontr 

HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\IPSEC\Policy\Local 
HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\IPSEC\Policy\Local 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NetSh\nshipsec 
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NetSh\nshipsec 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NetSh\nettrace 
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NetSh\nettrace 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NetSh\WcnNetsh 
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NetSh\WcnNetsh 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NetSh\p2pnetsh 
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NetSh\p2pnetsh 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NetSh\wlancfg 
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NetSh\wlancfg 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NetSh\wwancfg 
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NetSh\wwancfg 

HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\iphlpsvc\Config 
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\iphlpsvc\Config 

HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\iphlpsvc\config\Connectivity_Platform_Enabled 
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\iphlpsvc\config\Connectivity_Platform_Enabled 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography\OID\EncodingType 0\CryptDllFindOIDInfo\1.3.6.1.4.1.311.44.3.4!7\캰=諮=齎 
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography\OID\EncodingType 0\CryptDllFindOIDInfo\1.3.6.1.4.1.311.44.3.4!7\캰=諮=齎 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography\OID\EncodingType 0\CryptDllFindOIDInfo\1.3.6.1.4.1.311.44.3.4!7\Name 
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography\OID\EncodingType 0\CryptDllFindOIDInfo\1.3.6.1.4.1.311.44.3.4!7\Name 

C:\Windows\System32\p2pcollab.dll 
C:\Windows\System32\p2pcollab.dll 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography\OID\EncodingType 0\CryptDllFindOIDInfo\1.3.6.1.4.1.311.44.3.4!7\Name 
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography\OID\EncodingType 0\CryptDllFindOIDInfo\1.3.6.1.4.1.311.44.3.4!7\Name 

C:\Windows\System32\p2pcollab.dll 
C:\Windows\System32\p2pcollab.dll 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography\OID\EncodingType 0\CryptDllFindOIDInfo\1.3.6.1.4.1.311.47.1.1!7\(Default) 
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography\OID\EncodingType 0\CryptDllFindOIDInfo\1.3.6.1.4.1.311.47.1.1!7\(Default) 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography\OID\EncodingType 0\CryptDllFindOIDInfo\1.3.6.1.4.1.311.47.1.1!7\Name 
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography\OID\EncodingType 0\CryptDllFindOIDInfo\1.3.6.1.4.1.311.47.1.1!7\Name 

C:\Windows\System32\QAGENTRT.DLL 
C:\Windows\System32\QAGENTRT.DLL 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography\OID\EncodingType 0\CryptDllFindOIDInfo\1.3.6.1.4.1.311.47.1.1!7\Name 
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography\OID\EncodingType 0\CryptDllFindOIDInfo\1.3.6.1.4.1.311.47.1.1!7\Name 

C:\Windows\System32\QAGENTRT.DLL 
C:\Windows\System32\QAGENTRT.DLL 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography\OID\EncodingType 0\CryptDllFindOIDInfo\1.3.6.1.4.1.311.64.1.1!7\Name 
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography\OID\EncodingType 0\CryptDllFindOIDInfo\1.3.6.1.4.1.311.64.1.1!7\Name 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography\OID\EncodingType 0\CryptDllFindOIDInfo\1.3.6.1.4.1.311.64.1.1!7\Name 
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography\OID\EncodingType 0\CryptDllFindOIDInfo\1.3.6.1.4.1.311.64.1.1!7\Name 

C:\Windows\System32\dnsapi.dll 
C:\Windows\System32\dnsapi.dll 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography\OID\EncodingType 0\CryptDllFindOIDInfo\1.3.6.1.4.1.311.64.1.1!7\Name 
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography\OID\EncodingType 0\CryptDllFindOIDInfo\1.3.6.1.4.1.311.64.1.1!7\Name 

C:\Windows\System32\dnsapi.dll 
C:\Windows\System32\dnsapi.dll 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography\OID\EncodingType 0\CryptDllFindOIDInfo\1.3.6.1.4.1.311.67.1.1!7\ 0\Cryptﮐ 
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography\OID\EncodingType 0\CryptDllFindOIDInfo\1.3.6.1.4.1.311.67.1.1!7\ 0\Cryptﮐ 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography\OID\EncodingType 0\CryptDllFindOIDInfo\1.3.6.1.4.1.311.67.1.1!7\Name 
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography\OID\EncodingType 0\CryptDllFindOIDInfo\1.3.6.1.4.1.311.67.1.1!7\Name 

C:\Windows\System32\fveui.dll 
C:\Windows\System32\fveui.dll 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography\OID\EncodingType 0\CryptDllFindOIDInfo\1.3.6.1.4.1.311.67.1.1!7\Name 
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography\OID\EncodingType 0\CryptDllFindOIDInfo\1.3.6.1.4.1.311.67.1.1!7\Name 

C:\Windows\System32\fveui.dll 
C:\Windows\System32\fveui.dll 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography\OID\EncodingType 0\CryptDllFindOIDInfo\1.3.6.1.4.1.311.67.1.2!7\Name 
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography\OID\EncodingType 0\CryptDllFindOIDInfo\1.3.6.1.4.1.311.67.1.2!7\Name 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography\OID\EncodingType 0\CryptDllFindOIDInfo\1.3.6.1.4.1.311.67.1.2!7\Name 
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography\OID\EncodingType 0\CryptDllFindOIDInfo\1.3.6.1.4.1.311.67.1.2!7\Name 

C:\Windows\System32\fveui.dll 
C:\Windows\System32\fveui.dll 

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography\OID\EncodingType 0\CryptDllFindOIDInfo\1.3.6.1.4.1.311.67.1.2!7\Name 
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography\OID\EncodingType 0\CryptDllFindOIDInfo\1.3.6.1.4.1.311.67.1.2!7\Name 

C:\Windows\System32\fveui.dll 
C:\Windows\System32\fveui.dll 

HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\NapAgent\LocalConfig 
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\NapAgent\LocalConfig 

HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\napagent\LocalConfig\(Default) 
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\napagent\LocalConfig\(Default) 

HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\napagent\LocalConfig\Enroll\HcsGroups 
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\napagent\LocalConfig\Enroll\HcsGroups 

HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\napagent\LocalConfig\Enroll\HcsGroups\(Default) 

HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\napagent\LocalConfig\Enroll\HcsGroups\(Default) 
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\napagent\LocalConfig\Enroll\HcsGroups\(Default) 

HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\napagent\LocalConfig\Enable Tracing 
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\napagent\LocalConfig\Enable Tracing 

HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\napagent\LocalConfig\Tracing Level 
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\napagent\LocalConfig\Tracing Level 

HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\napagent\Qecs\79617 
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\napagent\Qecs\79617\Description 

HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\napagent\Qecs\79617\Registration Date 

HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\services\napagent\Qecs\79617\Validator Clsid 

... 

我在代碼中打印2值,它應該在2行中顯示相同的字符串。爲什麼有些行不顯示重複的字符串。

+0

你能擴展你所說的「所有功能應該」 - 「有些功能不重複」嗎?展開VS重複混淆了我。另外,您的輸入數據和您的文件中包含了什麼?顯然這個程序找到了一個重複的並正在打印的行,是不是這個想要的行爲? – Torxed

+0

我已經編輯它。我爲字符串匹配編寫代碼而不是關於函數。 – user572575

回答

0

因爲您在運算符中使用,因此不用於檢查重複的字符串。

這裏:

HKEY_LOCAL_MACHINE \ SYSTEM \ ControlSet001 \服務\ napagent \ Qecs \ 79617 HKEY_LOCAL_MACHINE \ SYSTEM \ ControlSet001 \服務\ napagent \ Qecs \ 79617 \說明

字符串HKEY_LOCAL_MACHINE \ SYSTEM \ ControlSet001 \

:服務\ napagent \ Qecs \ 79617只出現在字符串HKEY_LOCAL_MACHINE \ SYSTEM \ ControlSet001 \服務\ napagent \ Qecs \ 79617 \說明,但不重複

你可以嘗試用

+0

謝謝。我也必須去掉所有的字符串。 if resrc_lst [i] .strip()== line.split('',2)[2] .strip(): – user572575