小编bdf*_*dfy的帖子

如何在文件中找到单词的位置?

例如,我有文件和单词"测试".文件是部分二进制文件,但有字符串"test".如何在没有加载的文件中找到文字(索引)的位置来存储这个文件?

python

6
推荐指数
2
解决办法
2万
查看次数

如何在linux中更改文件访问权限?

如何更改文件访问权限?

f = open('test','w')
f.close()
Run Code Online (Sandbox Code Playgroud)

默认访问权限:10600

python

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

下载使用队列扭曲的文件

我想使用twisted和(例如)20个客户端线程从队列中下载许多文件.任何例子?

python twisted

4
推荐指数
1
解决办法
3793
查看次数

如何将int转换为24bit字符串?

为了阅读我使用:

def UI24(t):
    result = 0
    for i in xrange(3):
        result = (result << 8);
        byte = unpack('>b',t[i-1])
        result += byte;
    return result
Run Code Online (Sandbox Code Playgroud)

写的?

python

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

为什么打包这么慢?

我有一个简单的例子:

def __init__(self,string):
    self.string = string

def UI32(self):
    tmp = self.string[:4]
    self.string = self.string[4:]
    return unpack(">I",tmp)[0]

data = file.read()
U = UI(data)
for i in range(60000):
    test = UI32()

总时间:22秒!

python

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

如何区分一个非常大的数组?

我有2个非常大的数组.

这段代码运行得很慢吗?


results1 = [1,2,3..]
results2 = [1,2,3,4 ... ]


for result1 in results1:
    if result1 not in results2:
        print result1

python algorithm

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

如何通过伪复合键对字典进行排序?

我有一本字典:

test = {}
test[(1,2)] = 1
test[(4,3)] = 1
test[(1,4)] = 1
Run Code Online (Sandbox Code Playgroud)

如何按"伪复合键"排序:元组的第一个元素和元组的第二个元素之后?

python

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

标签 统计

python ×7

algorithm ×1

twisted ×1