This tag refers to the process of writing text or data to a file.
Questions tagged [file-writing]
932 questions
10
votes
1 answer
Parsing and pretty printing the same file format in Haskell
I was wondering, if there is a standard, canonical way in Haskell to write not only a parser for a specific file format, but also a writer.
In my case, I need to parse a data file for analysis. However, I also simulate data to be analyzed and save…

Dominik Schrempf
- 827
- 8
- 14
10
votes
1 answer
Using "with open() as file" method, how to write more than once?
Usually to write a file, I would do the following:
the_file = open("somefile.txt","wb")
the_file.write("telperion")
but for some reason, iPython (Jupyter) is NOT writing the files. It's pretty weird, but the only way I could get it to work is if I…

O.rka
- 29,847
- 68
- 194
- 309
9
votes
7 answers
Efficient way of writing to a text file in VB.NET
We have some information that we need to write (about 18 KB) to a .txt file stored on one of our network drives. The file is re-written about once every 15 minutes, but it is read practically at least every second. We are currently using…

AZhu
- 273
- 2
- 4
- 9
9
votes
3 answers
CSV Writing to File Difficulties
I am supposed to add a specific label to my CSV file based off conditions. The CSV file has 10 columns and the third, fourth, and fifth columns are the ones that affect the conditions the most and I add my label on the tenth column. I have code here…

Reginsmal
- 127
- 9
9
votes
2 answers
How to write at a particular position in text file without erasing original contents?
I've written a code in Python that goes through the file, extracts all numbers, adds them up. I have to now write the 'total' (an integer) at a particular spot in the file that says something something something...Total: __00__ something…

learnerX
- 1,022
- 1
- 18
- 44
8
votes
1 answer
Node.js Writing into YAML file
I'm using Node.js and I'm having trouble figuring out how could I read a YAML file, replace a value in it, and write the updated value to the YAML file.
I'm currently using the module "yamljs" which allows me to load the YAML file and I've managed…

TenDRILLL
- 201
- 1
- 3
- 8
8
votes
2 answers
How to correctly write to a file using Parallel.ForEach?
I have a task which reads a large file line by line, does some logic with it, and returns a string I need to write to a file. The order of the output does not matter. However, when I try the code below, it stops/get really slow after reading 15-20k…

justindao
- 2,273
- 4
- 18
- 34
7
votes
1 answer
Writing to file on github pages using javascript
Is there any way of writing to a file on github pages using javascript? I want to save some info that i wanna use elsewhere to a json file (preferably, but txt would also work), and was wondering if it was possible.

Kris10an
- 548
- 3
- 23
7
votes
1 answer
Opening already opened hdf5 file in write mode, using h5py
I run the same Python program concurrently as different processes, and these all want to write to the same hdf5 file, using the h5py Python package. However, only a single process may open a given hdf5 file in write mode, otherwise you will get the…

jmd_dk
- 12,125
- 9
- 63
- 94
7
votes
2 answers
When I write to a text file using sp_OAMethod nothing shows up
I am trying to write to a file with Transact-SQL using a stored procedure that I can pass input to. However, every time I run the commands in SQL Server 2012 it displays Command(s) completed successfully., but I navigate to the text file and I don't…

M. Barbieri
- 512
- 2
- 13
- 27
6
votes
2 answers
Python 2.7 CSV file read/write \xef\xbb\xbf code
I have a question about Python 2.7 read/write csv file with 'utf-8-sig' code, my csv . header is
['\xef\xbb\xbfID;timestamp;CustomerID;Email']
there have some code("\xef\xbb\xbfID") I read from file A.csv and I want write the same code and header…

SharpLu
- 1,136
- 2
- 12
- 28
6
votes
0 answers
Python file writing memory usage
I have some gigantic unsorted files of IDs like:
file1.txt
a1
a2
a3...etc
file2.txt
b1
a2
c1...etc
And I'm trying to eventually put them a single, sorted file. They are multiple gigabytes each so I can't load them all into memory.
My current…

LittleBobbyTables
- 4,361
- 9
- 38
- 67
6
votes
1 answer
Appending JSON struct to JSON file Golang
I have a JSON document of Users where they have an ID#, Phone#, and Email. Upon input of another ID, Phone, and Email, I want to take a new user's information and append it to the file. I have a structure that only contains an {ID: #, Phone: #,…

Rohit Panikar
- 85
- 2
- 2
- 5
6
votes
3 answers
Groovy: Appending to large files
How do I append to large files efficiently. I have a process that has to continually append to a file and as the file size grows the performance seems to slow down as well. Is there anyway to specify a large buffer size with the append

Eqbal
- 4,722
- 12
- 38
- 47
6
votes
3 answers
Concurrent read/write file in Java
I have to read a text file from my Java application.
The file contains many rows and this file is updated every X minutes from an external unknown application that appends new lines to the file.
I have to read all the rows from the file and then I…

Roberto Milani
- 760
- 4
- 20
- 40