小编Jay*_*sby的帖子

如何删除Google Chrome Cookie

我正在尝试删除Chrome浏览器的cookie.首先我宣布了这条道路

string chromeLocation1 = "C:\\Users\\" + Environment.UserName.ToString() + "\\AppData\\Local\\Google\\Chrome\\User Data\\Default\\Local Storage";
Run Code Online (Sandbox Code Playgroud)

当我尝试运行我的删除代码"该文件正被另一个程序或用户使用"时出现错误.所以我试图杀死chrome.exe进程

foreach (var process in Process.GetProcessesByName("chrome.exe"))
{
    process.Kill();
}
Run Code Online (Sandbox Code Playgroud)

但现在它给我"访问被拒绝"错误,即使我以管理员身份运行它.我该怎么做才能删除这些cookie?

c# cookies google-chrome

2
推荐指数
1
解决办法
7062
查看次数

Python计时器'NoneType'对象不可调用错误

我想创建一个程序,每10秒检查一次给定的URL

def listener(url):
    print ("Status: Listening")
    response = urllib.request.urlopen(url)
    data = response.read()
    text = data.decode('utf-8')
    if text == 'Hello World. Testing!':
        print("--Action Started!--")


t = Timer(10.0,listener('http://test.com/test.txt'))
t.start()
Run Code Online (Sandbox Code Playgroud)

这是输出:

Status: Listening
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python3.4/threading.py", line 920, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.4/threading.py", line 1186, in run
    self.function(*self.args, **self.kwargs)
TypeError: 'NoneType' object is not callable
Run Code Online (Sandbox Code Playgroud)

它运行该功能一次,10秒后出现错误

python multithreading

2
推荐指数
1
解决办法
5583
查看次数

无法生成大素数

我正在尝试用Java生成大的素数.我使用BigIntegers.这是我在数组中生成和存储10个素数的代码.

    public static void primeGenerator() {
    BigInteger[] primeList = new BigInteger[10];
    BigInteger startLine = new BigInteger("10");
    int startPower = 6;
    BigInteger endLine = new BigInteger("10");
    int endPower = 9;
    int j = 0;
    for (BigInteger i = fastExp(startLine,startPower); 
            i.compareTo(fastExp(endLine,endPower)) <= 0; 
            i = i.add(BigInteger.ONE)) {
        if (checkPrimeFermat(i) == true && j < 10) {
            primeList[j] = i;
            j++;
        }
    }

    System.out.println(primeList[0]);
    System.out.println(primeList[1]);
    System.out.println(primeList[2]);
    System.out.println(primeList[3]);
    System.out.println(primeList[4]);
    System.out.println(primeList[5]);
    System.out.println(primeList[6]);
    System.out.println(primeList[7]);
    System.out.println(primeList[8]);
    System.out.println(primeList[9]);


}
Run Code Online (Sandbox Code Playgroud)

我编写了自己的fastExp函数来更快地生成数字.这是我的其他功能.

public static BigInteger getRandomFermatBase(BigInteger n)
    {
        Random rand …
Run Code Online (Sandbox Code Playgroud)

java biginteger

0
推荐指数
1
解决办法
232
查看次数

检查 for 循环中的下一个元素

假设我有这个数组:

arr = ["foo","bar","hey"]
Run Code Online (Sandbox Code Playgroud)

我可以"foo"用这个代码打印字符串:

for word in arr:
    if word == "foo":
        print word
Run Code Online (Sandbox Code Playgroud)

但我还想检查下一个word是否等于"bar"然后它应该打印"foobar"

如何检查 for 循环中的下一个元素?

python

0
推荐指数
1
解决办法
3172
查看次数

将变量添加到字典

我有一本空字典

d = {}
Run Code Online (Sandbox Code Playgroud)

我有这些变量:

key = "foo"
value = 1
Run Code Online (Sandbox Code Playgroud)

我想将它们作为keyvalue变量添加到字典中,因为它们可以在 for 循环中更改。正确的语法应该是什么?

python

-3
推荐指数
1
解决办法
2万
查看次数

标签 统计

python ×3

biginteger ×1

c# ×1

cookies ×1

google-chrome ×1

java ×1

multithreading ×1