'tuple' object has no attribute 'read'

I am trying to create a program that will read from a file on my computer. The file consists of simply door numbers from 1-150 within a bracket. The error returns at line 6. print(file.read()) your text#opening_a_file.py your textfile = "This PC/C:/Python Programming/Doors.txt","r" your textprint("read function: ") your textprint(file.read()) your textprint() your textfile.seek(0) I tried… Read More 'tuple' object has no attribute 'read'

Trying to read a big file of 500,000 lines and store it in an array in java

which checks the performance of different sorting algorithms. We were given a .txt file with 500,000 words, which are going to be sorted with these algorithms. I wrote the method that reads the file and stores the words in a String array. The first Scanner counts the number of lines and the second Scanner creates… Read More Trying to read a big file of 500,000 lines and store it in an array in java

How to read a txt file from the last of its lines to the first of its lines?

I need to read this file with a python code but in an inverted way to obtain the output that I will indicate below. sp_ordinal_numbers_info.txt 1: Primero 2: Segundo 3: Tercero 4: Cuarto 5: Quinto 10: Décimo 715: Septuagentésimo décimo quinto This is the code that will read the text file, modify it line by… Read More How to read a txt file from the last of its lines to the first of its lines?

How to store data from reading lines in nodejs

Hello I have external txt file with data to my function. How can I store read line to variable const fs = require("fs"); const readline = require("readline"); const firstVariable; [it is firstLine] const secondVariable; [it is secondLine] const thirdVariable; [it is thirdLine] const fourthVariable; [it is fourthLine] const readInterface = readline.createInterface({ input: fs.createReadStream("./slo1.in"), output: process.stdout,… Read More How to store data from reading lines in nodejs

Never ending loading icon when rendering a web page in nodejs

The following code comes from an academic example, its intention is to load a page that exists in the file system: const sendErrorResponse = res => { res.writeHead(httpStatus.NOT_FOUND, {"Content-Type": "text/html"}); res.write("<h1>FILE NOT FOUND</h1>"); res.end(); }; const customReadFile = (file_path, res) => { if (fs.existsSync(file_path)){ fs.readFile(file_path, (error, data) => { if (error) { sendErrorResponse(res); return; }… Read More Never ending loading icon when rendering a web page in nodejs