Questions tagged [readlines]
This tag refers to the `readlines` method available on file objects in Python.
readlines
508
questions
0
votes
1
answer
56
views
Read lines of Txt file, edit specific lines, then write full Txt file to new file - C#
I'd like to read a Txt file with parameters and values then update the values of specific parameters. I don't know the original value of the parameter before changing but have a list of parameter ...
0
votes
0
answers
33
views
R timeout with readLines
I'm using a package called chemminR to look for molecules that are similar to each other in structure. I have been able to run this code with success for some of the values I am inputting, but for ...
0
votes
2
answers
42
views
need to close after FILE.READLINES
I need to read all content of a file but keep only some of the content and append new content. So I tried to use READLINES filter the lines I need to keep then rewrite the file with the kept lines and ...
0
votes
1
answer
28
views
readlines files in r with differents encoding
I have :
guess_encoding("file.txt")$encoding
[1] "UTF-8" "ISO-8859-1" "ISO-8859-2"
I want to read my file :
lines <- readLines("file.txt", ...
1
vote
2
answers
52
views
Check whether a string contains a specific word and change it
i am a magnitologist and i am trying to make automation of the routine problem using python. Now i work with the file :
with open('test3.txt') as file:
my_list = file.readlines()
b = [line....
0
votes
2
answers
81
views
Python loop doesn't work with readlines()
It suppose to count amount of "-------------------------" lines but it doesn't work, also line with print("test") doesn't shows in console and it always returns 0. But for example ...
1
vote
1
answer
181
views
How to convert data in a character class object to dataframe in R
I basically have the same (unanswered) question as this fellow here -- I want to import the .raw data file at this link and convert the data within into a matrix/dataframe.
I downloaded redwt.raw to a ...
0
votes
2
answers
57
views
Read a file to check for existence of multiple strings
I'm a SAS/Python person and I have to back-fill for a C# programmer . . . .
I need to pre-process a file before it is read into my company's software to make sure it is the correct file type. The ...
0
votes
3
answers
72
views
Is there a better way to access values in a JSON file than a 'for' loop?
I have a JSON file which looks like this:
[{'data': [{'text': 'add '},
{'text': 'Stani, stani Ibar vodo', 'entity': 'entity_name'},
{'text': ' songs in '},
{'text': 'my', 'entity': '...
1
vote
3
answers
84
views
Parse a file and create a data structure
We want to parse a file and create a data structure of some sort to be used later (in Python). The content of file looks like this:
plan HELLO
feature A
measure X :
src = "...
0
votes
2
answers
103
views
Need to parse a file and create a data structure out of it [closed]
We want to parse a file and create a data structure of some sort to be used later (in Python).
The content of file looks like this:
plan HELLO
feature A
measure X :
src = "...
0
votes
3
answers
120
views
convert two input files into certain string rules by python
Let's say there are two input files as below:
input1.txt (only composed of hstep3_*)
hstep3_num00 = a5;
hstep3_num01 = 3b;
hstep3_num02 = 4f;
hstep3_num03 = 27;
input2.txt ( the letters inside ...
-1
votes
2
answers
45
views
Python open file and get eveyrthing before second space
I have this in my file:
2023-09-08 10:40:04 twitter
2023-09-08 10:40:05 sreality
I need to get first and second text from the last line.
I tried this but it get only text before first space:
with ...
-1
votes
1
answer
36
views
Identifying and extraction of its adjacent word from using readlines() and split() method in python
Would like to perform following operations.
Step 1 -> From the *.k file would like to read all the lines.
Step 2 -> Identifying specific word (Ex: "endtim") from this file.
Step 3 ->...
1
vote
0
answers
95
views
readLines in R is not reading complete text file
I am having a problem reading text files that were created when exporting the output from Android's Top command line that was running in a console.
The script I am using to read the file is pretty ...