1
在此代碼中,如何在單個語句中檢查單個字符串中的多個字符串?在python中搜索單個字符串中的字符串
line = '{ AutoLogin = 0; Captive = 0; Closed = 0; Disabled = 0; LastConnected = "2013-11-27 08:38:10 +0000"; Passpoint = 0; PossiblyHiddenNetwork = 0; SPRoaming = 0; SSID = <534253>; SSIDString = SBS; SecurityType = "WPA/WPA2 Personal"; SystemMode = 1; TemporarilyDisabled = 0; })'
for token in line.split(';'):
if 'RecentNetworks' in token:
start = True
if 'LastConnected' in token:
start = True
將「行」爲JSON,在這種情況下,可能更容易將字符串解析爲json。 –