FAQ Database Discussion Community


Using a text file as a set of values swift [duplicate]

ios,swift,set,text-files
This question is an exact duplicate of: Getting a set of values from resource file swift [closed] I'm working on a project that selects one or more words contains entered(user) keywords.That's why I'm using a set. But the set is turkish dictionary. That is to say, it contains 68k...

C code to read a text file does not find EOF (end of file)

c,text-files,infinite-loop,eof
I've wrote this short code to read a text file and copy its information to a new txt file, but doing some character substitution in the process. My problem is, the code does all the job it is supposed to do but it doesnt end. It cant find the EOF...

Reading multiple text files into an array in C

c,arrays,text-files
I am writing a program that opens numerous text files and reads from them parameters for planetary bodies. I have a problem when reading the text files. sample text file 2 1, 1, 2 3.5, 3, 4 The first number (2) refers to the number of bodies found in the...

Read graphs from file as fast as possible

c,input,graph,text-files
I have a txt file that contains 2 graphs and the number of vertices in the following format: 6 0 1 0 1 0 0 1 0 1 0 0 1 0 1 0 1 0 0 1 0 1 0 1 0 0 0 0 1 0 1 0...

Reading specific columns from a text file in python

python,list,text-files
I have a text file which contains a table comprised of numbers e.g: 5 10 6 6 20 1 7 30 4 8 40 3 9 23 1 4 13 6 if for example I want the numbers contained only in the second column, how do i extract that column...

Why does opening a file in two different encodings work as expected?

python,python-3.x,encoding,character-encoding,text-files
Quoting from here, The default encoding is platform-dependent, so this code might work on your computer (if your default encoding is utf-8), but then it will fail when you distribute it to someone else (whose default encoding is different, like CP-1252). Code mentioned in the above quote: fp = open('text.txt')...

Output Batch File Results to Text File AND to the screen itself

windows,batch-file,logging,cmd,text-files
I've got a Mass IP address pinger written in a Batch File that reads IP's in a Text File and then tells the user on the CMD screen if the IP is "OK" or "Failed to respond"... @echo off for /f "delims=" %%a in (iplist.txt) do ping -n 1 %%a...

How to check if sub-folder text file exists

vb.net,text-files
I am trying to search if a text file in a sub-folder exists. This is the code I am using: 'Checks the program's root folder to see if the root folder exists. Dim FolderName = New DirectoryInfo(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "Cake Orders\" & TextBox1.Text)) Dim McKnwoll As String = Path.Combine(FolderName.FullName, Trim(TextBox2.Text) & ("...

Save one part of a text file

python,python-3.x,text-files
I use a Rancid server to save information about Cisco switches on a network. I would like to write a Python 3 script to extract the configuration part of the data to a text file. I have gotten this to work but I have a file which has the configuration...

Unique words save to text file as a word per line

python,file,python-3.x,io,text-files
[using Python 3.3.3] I'm trying to analyse text files, clean them up, print the amount of unique words, then try to save the unique words list to a text file, one word per line with the amount of times each unique word appears in the cleaned up list of words....

How to generate text files and download a zip file in Javascript?

javascript,download,zip,text-files
I would like to know the best way in Javascript (maybe in JQuery) to do the following things without server coding if able : Generate around 20 text files from sets of objects. Zip these files into a ZIP file. Download this ZIP file. 1. Generate around 20 text files...

Plotting a string of numbers from text file

python,file,matplotlib,plot,text-files
I have a text file (m.txt) with numbers in the form: 4.52987812069 3.71367858211 4.50621674483 5.17260331988 5.06400394036 etc I want to plot these using matplotlib however when I do all of the numbers in m.txt get printed on 0 on the x-axis. I obviously want each value in m to be...

Select specific data in text file to import in 2d array in c++

c++,multidimensional-array,text-files
I am new to C++ programming and I am trying to open a text file where most of the information isn't useful to me. The file looks like that: 1 547 troncons 0 1 2 ... 2 2 3 4 5 7 ... 0 4 5 ... ... So as...

read all lines in text file with separator

c#,text-files,readline
I have a file with this content : 1,2,3,4,5# 1,2,3,4,5# How can i read all lines using readline ?the important thing is i need to separate the values in each line ,i mean the first line's values 1,2,3,4,5 should be separated . Suppose i have an array named myarray that...

Trouble with reading a subsection of a text file using comparison operators and string compare function

c++,text-files
So, I'm trying to read the portion between the 400 and the ***** in the following text file: 400 http://csweb.cs.wfu.edu http://college.wfu.edu/cs/wp-content/themes/wfcollegeonepro http://college.wfu.edu/cs/sample-page/feed http://college.wfu.edu/cs/wp-includes/wlwmanifest.xml http://college.wfu.edu/cs http://www http://www.wfu.edu http://college.wfu.edu http://college.wfu.edu/cs/news ***** 16331 http://college.wfu.edu/cs/wp-content/themes/wfcollegeonepro http://csweb.cs.wfu.edu http://college.wfu.edu/cs/sample-page/feed...

Write multiple prints in a text file

python,text-files
I have searched the page for an answer but could only find similar topics that don't exactly touch my specific question. I'm trying to generate some Dna sequences to play around with biopython and to write all of them into a txt.file. import random as r def random_dna_sequence(length): return ''.join(r.choice('ACTG')...

Preventing a user from deleting, modifying, ext

c#,text-files
I need to make a program that reads data from a text file and changes the program state according to specific data found in the text file, where my program needs privileges to read, write and create a text file. I want the users or even other software to be...

How do I pull out the data file to find Average? Logic Help C++

c++,logic,text-files
What is happening is I have a .txt file in my project like this. 4567 4 180 140 170 150 4693 1 119 4690 5 200 120 135 136 4693 2 149 133 4783 3 133 123 140 4824 3 130 155 120 4833 2 119 186 1st column is...

Unix one-liner to swap/transpose two lines in multiple text files?

bash,unix,awk,sed,text-files
I wish to swap or transpose pairs of lines according to their line-numbers (e.g., switching the positions of lines 10 and 15) in multiple text files using a UNIX tool such as sed or awk. For example, I believe this sed command should swap lines 14 and 26 in a...

How to read 2nd level sub-directory text file in vb.net

vb.net,text-files
I have a little program which is supposed to read text from a text file. The text file is contained in a sub-directory as follows: Customer > Sub-directory 1 > Sub- directory 2 > Text file The code I am using is: Dim ti = New DirectoryInfo(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "Customers\" & TextBox1.Text))...

Python Append From Text file outputs error

python,dictionary,append,text-files
I am currently testing the third phase of my program, and this errors repeatedly appears throughout the testing of this code below: I am attempting to read in some values into a dictionary and printing the dictionary to show me the last three scores of each user (I originally...

C# overwrite first few lines of a text file [duplicate]

c#,text-files
This question already has an answer here: StreamWriter replace line with a new text 1 answer I have a text file: FIRST LINE SECOND LINE THIRD LINE ... I want to overwrite the first line of the file, eg. with "2345" with the StreamWriter, I can only overwrite the...

Trouble constructing an object with data in a text file using commas as delimiters

java,text-files,java.util.scanner
I'm having trouble creating an Inventory object through a constructor that is reading from a txt file. This is the file: 1165,4.25,15 1305,1.80,42 1345,12.56,16 1388,7.42,30 1480,6.54,80 1495,8.36,48 1560,15.27,65 So I'm attempting to grab the "1165" into the first variable then "4.25" into the next, etc. So the comma is the...

Reading from a textfile in a certain format

c,text-files,filestream
I am trying to read from file in this order: 0 0 4 (100) 12 (67) 2 this correspondes to: process id, arrival_time, 1st_CPU_burst, (1st_IO_burst), 2nd_CPU_burst, (2nd_IO_burst) This has something to do with operating system fundamentals I am trying to perform fcfs scheduling with a queue but before I do...

Shell script file, checks if text file is empty or not

shell,text-files
I want to check if .todo.txt is empty or not. If is is empty, I want to add the echo in the file, and if it already has content, I want to do something else. I tried: hasData() { echo "Hello" } isEmpty() { echo -e "$n\t$comment\t$dueD/$dueM/$dueY " >> .todo.txt...

Android: display sentence from text file stored in res/raw folder

android,text-files
I am new to android and i Struck at this point.My text file contains wordings with number like 1abcd efg hij klmn opqrs. 2hdgh eydg ieuyhd gdhdgl. 3hdgf dhgfhs fhghs dhghj. and so on. Now i need to display full sentence start with 1. please help me out from this...

How to search for a sentence +1 in a file?

java,search,text-files,java.util.scanner
Okay so i am trying to store all user input into a text file. Eg if a user enters a question i search the text file for that question. if the question is found the next line in the text file would be the answer to the question. So my...

MATLAB - Need to make a cell array from a text column file

matlab,machine-learning,text-files
I have a database from UCI Machine Learning (Abalone Database)and I need to separate the first column, which is a character, from the other columns, which are double. The second part I already have with this code: abaloneData = csvread('abalone.data',0,1); I tried a lot to gatter the first part to...

Reading a text file using Javascript

javascript,html,html5,text-files
The following code should read the content of a text file which is in the current directory upon load, and display it on the html page. I tried modifying by my self. But it does not give an output. Is there an easier way to get this result using another...

Read Same Text File in Different Methods

c#,winforms,text-files,readfile
In the BtnNext_Click method it's just reading from the text file like it was a different text file, and not from the one that already was opened. It does not go from line to line. I need help Here is the code: public void ScrubData() { string FileName1; string FilePath1;...

display the text file item from certain column in jcombobox

java,string,swing,text-files,jcombobox
I am populating jComboBox1 from data.txt file. I am using this code to populate jComboBox1. The structure of text file as follows: AAA 123456 BB 22 Some text AAA 234567 CC 23 Some text AAA 345678 DD 24 Some text The goal that I want to achieve is display in...

Store patient information into text file and load it afterwards

java,arrays,arraylist,text-files
We got the task to write a simple Hospital Management System. The user is able to enter the patient information such as name, gender, date of birth and disease. The data is stored in an ArrayList and saved into a textfile. Now to my problem: I need to display all...

Populate GPO from Text File using VBScript or other

vbscript,text-files,group-policy,gpo
Ok, so we need to create a GPO that allows our users to only use specific programs. GPO Location: User Configuration Policies Administrative Templates [...] System Run only specified Windows applications Then setting the GPO to enabled and clicking on List of allowed applications --> Show... I have created an...

Javascript and Cordova/Phonegap FileWriter gives Invalid_Modification_Error on a simple text file write

javascript,ios,cordova,text-files,filewriter
I am using Cordova File and FileTransfer plugins. I have the following permissions set in my config.xml <feature name="File"> <param name="ios-package" value="CDVFile" /> </feature> <feature name="FileTransfer"> <param name="ios-package" value="CDVFileTransfer" /> </feature> I am trying to write a plain text file using the following piece of code: this.writeFile = function (filename,...

Combination into a file done in powershell (String + Variable)

string,function,variables,powershell,text-files
My question is related about how can I write a line that combines a string (that contains a $ symbol) and a variable into a single line that goes into text file. I'm creating a ps1 from a function. function pwd{ param( [Parameter(ValueFromPipeline=$True,position=0,mandatory=$true)][String]$Temp, [Parameter(ValueFromPipeline=$True,position=1,mandatory=$true)][String]$Path, [Parameter(ValueFromPipeline=$True,position=2,mandatory=$true)][String]$SubscriptionName ) $NewFilePath = "$Path\newfile.ps1" New-Item...

Reading data separated by colon per line in Python

python,text-files
I'm creating a program that has the user's name and their answers to a guess the number game in a database - like format on Python. I have created a text file where all of the users' data is, in the form name : guess. For instance, Dave:23 Adam:12 Jack:13...

Need to update a text file with new content found in an other text file

bash,shell,text-files
hello i was update a file, removing some content from it, now that i have to new file i want it's content back to the original file hidden=Desktop/newtodo.txt do echo -e "$y \t $line" >> $hidden y=$(($y+1)) done newtodo.txt > todo.txt i have content in todo.txt i updated them in...

Outputting items in two combined lists in descending numerical order?

python,arrays,file-io,text-files
I have a txt file that looks like this: Raj,Joy:9,8,1 Smith,John:8 Campbell,Michelle:5,7,9 NOTE: There is no empty lines between the lines of text in the text file I want to output each result of each person in descending numerical order, e.g. Campbell,Michelle:9 Raj,Joy:9 Raj,Joy:8 Smith,John:8 Campbell,Michelle:7 etc. The code I...

Android editting text file and saving strings to sharedpreferences

android,arrays,string,sharedpreferences,text-files
Ive managed to implement this into my code and get it to work, however my values are coming like this: 10.020.0, how can i put a space between 10.0 and 20.0 so it comes 10.0 20.0 Also if someone could help me figure out an alternative way to save this...

Python program wont write all information to .txt but it will to the shell ANSWERED

python,text-files
from time import sleep import platform, os, sys log = open("reportLog.txt", "w") log.write("####REPORT####\n") try: sys =("SYS: " + platform.system()+ ("\n")) syslog = log.write(sys) syslog() except: pass try: os = ("OS: " + platform.os()+ ("\n")) oslog = log.write(os) oslog() except: pass try: platform = ("PLATFORM: "+ platform.platform()+ ("\n")) platoformlog = log.write(platform)...

How to print the content of multiple text files with one click

vb.net,visual-studio-2010,text-files
Is there a way to print text from several text files with one click of a button? The code I am currently using is shown below. Dim FilePath = New DirectoryInfo(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "Employee Record\" & TextBox1.Text)) Dim FileNameRTO As String = Path.Combine(FilePath.FullName, TextBox2.Text + ".RTO") Dim ObjectReaderRTO As New System.IO.StreamReader(FileNameRTO) RichTextBox1.Text...

Writing a “\t” to a text file creates a line?

java,text-files,line-numbers
I'm writing to 2 textfiles and I wanted a eaiser way to read the textfiles without all the words and number laying to close to eachother so I chose to write them with a tab to seperate them. But when I do this my class LineNumberReader seems to think that...

Java text file remove doubles from four column text file

java,io,text-files
I have to write a code to take a text file, which contains integers and doubles, and to print the doubles in a file and the integers in another one. The text file is formatted in the following way: double int int int double int int int ... double int...

VB.net txt text file merge / concatenate all files

vb.net,text-files,concatenation
I have combined all logfiles by using the following code and shelling to dos. pi2.Arguments = "/c for /r c:\logs " + "%F in (*.*) do @type " + """%F """ + ">>c:\logs\Master" pi2.FileName = "cmd.exe" p2.StartInfo = pi2 p2.Start() p2.WaitForExit() This put all the information in one file but...

Create a text file table with java with padding

java,arrays,table,text-files,padding
Ok since my last text aand question was very vague here is my source as of now and a clearer question. It is all about the padding now. Here is my code up to now: import java.io.BufferedWriter; import java.io.FileWriter; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; public class makeTable { static...

grep: Invalid regular expression

linux,bash,shell,grep,text-files
I have a text file which looks like this: haha1,haha2,haha3,haha4 test1,test2,test3,test4,[offline],test5 letter1,letter2,letter3,letter4 output1,output2,[offline],output3,output4 check1,[core],check2 num1,num2,num3,num4 I need to exclude all those lines that have "[ ]" and output them to another file without all those lines that have "[ ]". I'm currently using this command: grep ",[" loaded.txt | wc...

How to create or modify a QT form (after compilation) based on a text file

c++,windows,qt,text-files
I would like to create a windows application that displays a window based on a existing text file. For example, I may have a text file with the following information: window_size 400, 300 push_button 2 radio_button 5 My program should be able to read this text file and create a...

How to get certain information out of arraylist grouped into other lists in Java

java,arraylist,text-files,group,information-retrieval
I wrote a program, that reads multiple (similar) textfiles out of a Folder. Im splitting the information by space and store everything in one arraylist which contains data kind of this: key1=hello key2=good key3=1234 ... key15=repetition key1=morning key2=night key3=5678 ... Now I'm looking for a way to get those information...

Count lines in ASCII file using C

c,ascii,text-files
I would like to count the number of lines in an ASCII text file. I thought the best way to do this would be by counting the newlines in the file: for (int c = fgetc(fp); c != EOF; c = fgetc(fp)) { /* Count word line endings. */ if...

Rewriting my scores text file to make sure it only has the Last 4 scores (python)

python,dictionary,text-files
Previously, I had - with the help of SO users - been able to find how to store a maximum of 4 keys inside a Python Document with the maxlength property inside the dictionary. Now, I want to go further. Below is a text file with all the recent scores...

Column width goes back to orignal when importing .txt files EXCEL 2013

excel,text-files
I have different .txt files which I frequently have to import on the same sheet on excel. The problem I am having is that after I manually adjust the width of the columns, and then import a new .txt file, the size of the columns go back to the original...

Split a text file if two consecutive lines almost identical

windows,batch-file,command-line,text-files
I need to split a text file (using a .bat command) based on the content of the string of the previous line (from position 2 to 13) and the content of the string of the current line (from position 2 to 13)... I explain: My file looks like that: IA1234567890A...

Float must be a string or a number?

python,type-conversion,text-files
I have a very simple program. The code: money = open("money.txt", "r") moneyx = float(money) print(moneyx) The text file, money.txt, contains only this: 0.00 The error message I receive is: TypeError: float() argument must be a string or a number It is most likely a simple mistake. Any advice? I...

Cannot print the final data in a line

java,text,text-files
I have a question here.I need to open a text file and the print the output according the the pattern i want.I used regex pattern method to get the desired pattern.I wan remove the curly braces,commas and brackets.I managed to do so but i dont know why my code doesn't...

Creating a python table from key/counters text file

python,parsing,text-files
Text file example <counter name="abcb">70324360</counter> <counter name="efghij">1094</counter> <counter name="klm">0</counter> I want to create a function that will return the counter number(1094) when I call the counter name(efghij). I don't actually know where to start with that text file....

How to find a specific string in a .txt file Python

python,text-files
I have a large textfile on my computer (location: /home/Seth/documents/bruteforce/passwords.txt) and I'm trying to find a specific string in the file. The list has one word per line and 215,000 lines/words. Does anyone know of simple Python script I can use to find a specific string? Here's the code I...

Linked List Loop Iterations alter global variable head

c,loops,pointers,linked-list,text-files
When I attempt to establish my linked list using a while loop, the second iteration of the loop changes the global head. The values are read in from a file, into a string (buffer) and then tokenized to establish the values of .name and .id . The bottom code is...

How to write to a file without deleting privious existing data [duplicate]

java,file-io,text-files
This question already has an answer here: How to append text to an existing file in Java 19 answers I am try to write data to a text file. I am using this code: try (Writer writer = new BufferedWriter(new OutputStreamWriter( new FileOutputStream("filename.txt"), "utf-8"))) { writer.write("something"); } But while...

How to print select lines of a text file in python?

python-3.x,printing,text-files,line
I have a text file with multiple lines of text. Each line of text is split into two columns, separated by a comma. How do I write a program to print only the lines of the text file that have a specific value for the first column? So for example...

Sorting a DataTable by columns in a file

c#,arrays,linq,csv,text-files
I am reading a csv file and sorting it. I am trying to sort a DataTable to give me a output based on Bankname from datatable here is the code I already have: DataTable dt = new DataTable(); dt.Columns.Add("accountholder", typeof(string)); dt.Columns.Add("accountnumber", typeof(int)); dt.Columns.Add("accounttype", typeof(string)); dt.Columns.Add("bankname", typeof(string)); dt.Columns.Add("branch", typeof(string)); dt.Columns.Add("amount", typeof(double));...

Extracting columns containing a certain name

python,text-files,manipulation,extraction
I'm new to python and I'm trying to use it to manipulate data in large txt-files. I have a txt-file with more than 2000 columns, and about a third of these have a title which contains the word 'Net'. I want to extract only these columns and write them to...

Reading tab (\t) separated text from file in shell

bash,shell,text-files
my text file looks like this 1 get a 06-05-2000 2 get b 06-05-2001 3 get c 06-05-2002 4 get d 06-05-1442 5 get e 06-05-1998 6 get f 06-05-1909 I want to read what is after the first \t (tab) and store that in varA and what is after...

PHP: Filtering and posting a text file

php,csv,text-files,filtering
I have a text file that contains a persons surname, address, time of accident and reason of accident separated by a white space in a line. I need to filter this file by only the people that have called in at least two times for the same reason and echo...

If I have three different text file how do I read them then sort them by average?

python,file,sorting,text-files,average
I am currently writing a code where you ask maths questions. I have saved the students score along with their name in different folders for 3 different classes. Then I have three different files for each test they have done. I want a code that checks if their name is...

Error writing text into a .txt file in python

python-3.x,text-files
I am making a program that will 1. Create a text file 2. Allow a password to be stored 3. Allow a password to be changed 4. Add an additional password 5. Delete a specific password The problem is in def delete():. I put in three passwords on three seperate...

Split text file into several parts by character

vb.net,winforms,text-files,streamreader
I apologise in advance if there is already an answer to this problem; if so please just link it (I have looked, btw! I just didn't find anything relating to my specific example) :) I have a text (.txt) file which contains data in the form 1.10.100.0.200 where 1, 10,...

How to extract specific lines from a huge data file?

text-files,extract,large-files,data-files
I have a very large data file, about 32GB. The file is made up of about 130k lines, each of which mainly contains numbers, but also has few characters. The task I need to perform is very clear: I have to extract 20 lines and write them to a new...

NoSuchElementException: No Line Found, while reading in text file

java,text-files,java.util.scanner
I'm currently working on building a text adventure game, and I've run into a problem while trying to read in text files that contain the descriptions of the room. Whenever I run the program, I can properly read in and assign the first text file, but the second one throws...

How to get data's from text file in c#

c#,.net,text-files
I have a textile contains big amount of data ,first thing is i have to filter Leaf cell data which is scattered over there and here.For this first line i filtered is line beginning with ADD GCELL which contains primary data,next what i have to do is i have to...

How to search and delete multiple text files from a directory using code

vb.net,text-files,vb.net-2010
I have a treeview control on my form and from this form, I save data to text files to a desktop directory in the format: Dan Michael.TXT Dan Michael.GAT Michael Torns.STD I also have a button on the form which the user can click to delete any node, after that...

Reading text file and skipping blank lines in vb.net

vb.net,visual-studio-2010,text-files
I have the below code which appends the content of a text file to my RichTextBox1. Dim FileName = New DirectoryInfo(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "CLIENT HISTORY\" & TextBox1.Text)) For Each ClientDetailsCHT As FileInfo In FileName.GetFiles("*.CHT", SearchOption.TopDirectoryOnly) RichTextBox1.AppendText(File.ReadAllText(ClientDetailsCHT.FullName)) Next ' Send to printing sub This works fine. The problem I am having is that...

Python- creating a text file with a variable as a name

python,text-files,filenames
So im doing a project where my program creates a textfile named "Ten Green Bottles" and writes the 10 green bottles song in it, I have successfully got it working but i want to make it better. I started by making the amount of bottles optional to the user and...

Powershell Reading text file

powershell,text,text-files
I'm just wondering if it's possible to read the content of text file with specific index? What I mean is like this, for example: I have text file like this, 'test1.txt' 12345678900 ## ## readthistext 54321123440 ## ## hellothistext I just want to read the content of text file after...

How to randomize the text in a label

c#,random,label,text-files
How to read a random line from a text file and change the text in the label to be that random line, then after a drag and drop which i have coded(below) the label will change the text. The language is c#. I am a beginner so i apologize if...

Calling a function within fprintf syntax in C language

c,function,text-files
I'm trying to print my strings output into a separate file. The issue I'm running into right now is the fact that my code carries a function for a set of strings that adds dashed lines underneath my columns (purely cosmetics). How do I call this function inside my fprintf...

Only the last row is inserted to my sql database from a text file after splitting it with PYTHON

python,sql-server,csv,text-files
Below is my code for splitting a text file with a pipe as the delimiter and inserting it to the database . The problem is only the last row is inserted to my database but it reads the whole text file. Meaning, my text file have 34 entries and when...

Getting words out of a text file with C#

c#,text-files,ienumerable,yield-return
I want to apologize for my beginner mistakes and english. I have write a method that gets words that start with a "b" out of a randomtext file and return a IEnumerable. It has to work with a yield return. The problem is that i don't know how to write...

TypeError: argument of type 'int' is not iterable? What does it mean?

python,list,text-files
ClassNames = studentname and score if studentname not in ClassNames: ClassNames = ClassNames.append(studentname) for studentname in filename and ClassNames <= 3: FirstResult.append(score) SecondResult.append|(score) ThirdResult.append(score) The if line gives me the error: TypeError: argument of type 'int' is not iterable ...

Could not convert string to float - Reading from the fil

python,text-files
I have a text file like this Coffee 1 18.0 Coffee 2 25.0 I wrote a program to read and print out data from the text file, and my code is like this: file_coffee = open('coffee.txt','r') description = file_coffee.readline() while description != '': qty = file_coffee.readline() qty = qty.rstrip('\n') qty...

How do to I read in data from a text file which is carriage return line feed delimited to matlab?

matlab,text-files,carriage-return
I have a file which has a 32 line header of text, the rest is data (doubles) - one value on each line. Each line is carriage return line feed delimited. I have tried using: fscanf sscanf textscan and: dlmread This seemed the most likely option but I can't seem...

What did I do wrong in OOP in C++

c++,oop,text-files
I code my programe for showing student profile #include <iostream> #include <fstream> using namespace std; int main() { int array_size = 500; char * array = new char[array_size]; int position = 0; ifstream fin("data.txt"); if(fin.is_open()) { while(!fin.eof() && position < array_size) { fin.get(array[position]); position++; } array[position-1] = '\0'; for(int i...

Bash formatting text file into columns

arrays,bash,shell,text-files
I have a text file with data in it which is set up like a table, but separated with commas, eg: Name, Age, FavColor, Address Bob, 18, blue, 1 Smith Street Julie, 17, yellow, 4 John Street Firstly I have tried using a for loop, and placing each 'column' with...

Detect the dates from text in text file. And then list them out using python

python,date,text-files
I have a text file that contains dates in the text. these dates are of format ("march 2016" or "march 2, 2016"). I wish to list them out. Can anybody help me with this? this is my attempt import re regex = '\s(\w+)\s(\d+\,)\s(\d+)' # this will match the form "str...

How can i get the last integer saved to a textfile and display it i a TextView in Android?

java,android,android-studio,text-files
I'm saving random numbers to a textfile between 1-10 and i want to display the last saved number in the textfile in to a TextView so the user can see it. How can i look for the last saved value in a textfile? Is there any function for that? Thank...

Python: replacing multiple words in a text file from a dictionary

python,python-2.7,dictionary,replace,text-files
I am having trouble figuring out where I'm going wrong. So I need to randomly replace words and re-write them to the text file, until it no longer makes sense to anyone else. I chose some words just to test it, and have written the following code which is not...

Saving data from textfile to PostGreSQL database using php

php,postgresql,text-files
I want to read my text file line by line and then save to the postgresql database.But I got these ERRORS. "Warning: pg_query() [function.pg-query]: Query failed: ERROR: syntax error at or near "," LINE 2: VALUES (1113, , 21, , ); ^ in C:\xampp\htdocs\phpsave\index.php on line 28 ERROR: syntax error...

Searching for specific text in a text file. Returning it to a textbox

java,search,text-files,jgrasp
I am very new to java. I am working on project for class that would look up books in a text file and display information about them. Primarily if the book is in stock or not. The text file is set up like this: {ISBN, Author, Type, Stock} I have...

How can I get common rows that exist in at lest two files or more?

bash,text,text-files
I have seven test files. They look like following File 1 chr start end strand chr1 10525 10525 + chr1 10542 10542 + chr1 10571 10571 + chr1 10577 10577 + chr2 10589 10589 + chr2 565262 565262 + chr2 565397 565397 + chr3 567239 567239 + chr3 567312 567312...

Retrieving a value from a text file

android,text-files,storage
I am building an application that contains a quiz. As soon as the user finishes the quiz, an activity is shown to the user where it calculates his total score as a TextView. What I want to achieve here is storing that TextView value shown to the user at the...

I get an error with trying to parse the integer from the textfile [closed]

c#,text-files,system.io.file
I'm getting errors when I try to "login" to this. Its a school project and I know its simple, I just need it to function properly, any help is appreciated. Try to ignore obviously inefficient code. class UserVariables { public static int avatarC; public static int colourC; public static string...

Text file data importing to php

php,import,text-files
I am newbie to php coding. So here my problem goes, I need to get the data on a textfile. I have a text file like where data are like this: Return(result="success" dev_id="6714114030000088" total="14" time="2015-02-11 11:35:20" id="505" name="DIM" workcode="0" status="0" authority="0X11" card_src="from_check" time="2015-02-11 11:42:47" id="505" name="DIM" workcode="0" status="0" authority="0X11" card_src="from_check"...

Large text file and characters Limitation problems in a line

database,data,text-files
I have a text file that each line of it ,is a record of data with a specific structure. I want to read it Line by Line, in a specific Line for example in Line 1000 Change a data Like: sara , 1991 , Zakizadeh , Student , Tehran...