为什么public static string RequestWithProxies(string url, string[] proxies)
{
var client = new WebClient
{
Credentials = new NetworkCredential(username, password)
};
var result = String.Empty;
foreach (var proxy in proxies)
{
client.Proxy = new WebProxy(proxy);
try
{
result = client.DownloadString(new Uri(url));
}
catch (Exception) { if (!String.IsNullOrEmpty(result)) break; }
}
if (String.IsNullOrEmpty(result)) throw new Exception($"Exhausted proxies: {String.Join(", ", proxies)}");
return result;
}
语句返回不同的结果?:
输入1:
break
输出1:
list1 = [1,2,3,4]
for i in range(len(list1)):
for i in list1:
list1.remove(i)
print(i, list1)
#break
输入2:
(1, [2, 3, 4])
(3, [2, 4])
(2, [4])
(4, [])
输出2:
for i in range(len(list1)):
for i in list1:
list1.remove(i)
print(i, list1)
break