Does my file open in RAM in add mode?

I wrote code that continues to add the file. Here is the code for it:

writel = open('able.csv','a',encoding='utf-8',errors='ignore')
with open('test','r',encoding='utf-8',errors='ignore') as file:
    for i in file.readlines():
        data = functionforprocess(i)
        if data is not "":
            writel.write(data)
        if count% 10000 == 0:
            log = open('log','w')
            log.write(str(count))
            log.close()

My question is: is the file that I opened appendin RAM mode accessible ? This file acts like a buffer, meaning that if I store a variable datain a variable and then write the variable to a file, is it equal to opening the file in add and write mode directly?

Feel free to get me out of this confusion.

+4
source share
2 answers

- - . , fopen a a+ POSIX. / ; , , , write, . - ; . , fsync, ; , close , ( ); , - , .

, . , , , . , , . - , , , , . , append - , , , . - , , , , , , , . , , .

+2

open:

open(file, mode=’r’, buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None)

"a" (), : , , . .

. :

- , . 0, ( ), 1 ( ) > 1, . , :

  • ; , " " io.DEFAULT_BUFFER_SIZE. 4096 8192 .
  • "" (, isatty() True) . .

.

, . "" , .

+1

Source: https://habr.com/ru/post/1685012/


All Articles