Why python has limit for count of file handles?

前端 未结 6 621
隐瞒了意图╮
隐瞒了意图╮ 2020-11-27 05:38

I writed simple code for test, how much files may be open in python script:

for i in xrange(2000):
    fp = open(\'files/file_%d\' % i, \'w\')
    fp.write(s         


        
6条回答
  •  北荒
    北荒 (楼主)
    2020-11-27 06:06

    Most likely because the operating system has a limit for the number of files that an application can have open.

提交回复
热议问题