Math forum topic Community Center Meta DaniWeb by Eko Since programming has a lot in comun with math,I sugest to have a special topic for that , so that people don't have to go on other forums when they want to find out ,for example,the gauss method of solving matrices ,useful in creating a program that outputs the determinant of an matrix of nxn order Re: Math forum topic Community Center Meta DaniWeb by mattyd [quote=Eko;285370]Since programming has a lot in comun with math,I sugest to have a special topic for … Prolog Clue Game Programming Software Development by adixovi …(candelabro,3,'Es alargada'). pista_arma(pistola,1,'Es un arma comun entre los asaltantes'). pista_arma(pistola,2,'Es un arma met… Open CSV file and write new file Programming Software Development by karmstrong I'm attempint to write a python application that will open a .csv file and look at comun one for certain string. If the string match print the row to a new .csv file. import csv input_file = csv.DictReader(open("stats.csv")) for row in input_file: print row Re: Math forum topic Community Center Meta DaniWeb by Dani That is what the Computer Science and Engineering forum is for: [URL]http://www.daniweb.com/techtalkforums/forum14.html[/URL] Re: Math forum topic Community Center Meta DaniWeb by Dani Also ... you can use [tex] bbcode :) Re: Math forum topic Community Center Meta DaniWeb by Eko Oh,oki than :) I didn't realize that Engineering and Computer science involves math also(in my country the word engineering has a slightly different meaning) [COLOR=#CD6E1F][B] [/B][/COLOR] Re: Math forum topic Community Center Meta DaniWeb by Ancient Dragon [QUOTE=Eko;285392]Oh,oki than :) in my country the word engineering has a slightly different meaning [/QUOTE] the term "computer engineering" is misused by most people in the USA also. Most people who call themselves "computer engineers" are no such thing -- in USA engineers have to have an engineering degree and pass … Re: Math forum topic Community Center Meta DaniWeb by WaltP [QUOTE=Ancient Dragon;285468]the term "computer engineering" is misused by most people in the USA also. [/QUOTE] Not if we've defined the term itself to mean how we use it. What country first used the term "computer engineering"? We should ask them. Re: Math forum topic Community Center Meta DaniWeb by iamthwee [QUOTE=sharky_machine;286658][B]I heavily agree with this request for a Math room for DaniWeb.[/B][/QUOTE] [QUOTE=Dani]That is what the Computer Science and Engineering forum is for:[/QUOTE] [COLOR="White"].[/COLOR] Re: Math forum topic Community Center Meta DaniWeb by manutd Sharky, do you just go around supporting all new forums in [B]bold[/B]? Re: Math forum topic Community Center Meta DaniWeb by John A [quote=manutd;286956]Sharky, do you just go around supporting all new forums in [B]bold[/B]?[/quote] Of course not! [URL="http://www.daniweb.com/techtalkforums/post286657.html#post286657"]This post here[/URL] doesn't have 1 bold tag. :D But I do agree with manutd; there are times where bold isn't necessary (it gets annoying when … Re: Math forum topic Community Center Meta DaniWeb by ~s.o.s~ But still bold is better than red color.... Yep, our sharky used to post in red and different colors when he had first joined, it took me some time to explain why they should not be used.. Looks like nowadays he has developed an infatuation for bold...;) Re: Math forum topic Community Center Meta DaniWeb by WaltP [QUOTE=~s.o.s~;287285]Looks like nowadays he has developed an infatuation for bold...;)[/QUOTE]Hopefully it's just [url=http://en.wikipedia.org/wiki/Puppy_love]puppy love[/url] :p Re: Math forum topic Community Center Meta DaniWeb by ~s.o.s~ [quote=WaltP;287385]Hopefully it's just [URL="http://en.wikipedia.org/wiki/Puppy_love"]puppy love[/URL] :p[/quote] Whoa...I sometimes really wonder where you come up with all these links from...I mean a link which relates to each post is too good....:D Re: Math forum topic Community Center Meta DaniWeb by WaltP [QUOTE=~s.o.s~;287393]Whoa...I sometimes really wonder where you come up with all these links from...I mean a link which relates to each post is too good....:D[/QUOTE] I use [url=http://google.com]tools[/url]. :twisted: I'm not really [I]that[/I] smart. (I shouldn't have given that away, should I?) Re: Open CSV file and write new file Programming Software Development by karmstrong #!/bin/python import csv inFile = open('data.csv', "rb") reader = csv.reader(inFile) outFile = open('data2.csv', "wb") writer = csv.writer(outFile, delimiter='\t', quotechar='"', quoting=csv.QUOTE_ALL) for row in reader: if "cat" in reader: writer.writerow(… Re: Open CSV file and write new file Programming Software Development by woooee This code writes every row to the output file if "cat" is found anywhere in the file. for row in reader: if "cat" in reader: writer.writerow(row) For three different strings, you would use something like for row in reader: found = False for col in row: if col in [… Re: Open CSV file and write new file Programming Software Development by karmstrong ` import csv string_1 = ('OneTouch AT') string_2 = ('LinkRunner AT') string_3 = ('AirCheck') inFile = open('data.csv', "rb") reader = csv.reader(inFile) outFile = open('data2.csv', "wb") writer = csv.writer(outFile, delimiter='\t', quotechar='"', quoting=csv.QUOTE_ALL)… Re: Open CSV file and write new file Programming Software Development by Gribouillis You can write searched = ['onetouch at', 'linkrunner at', 'aircheck'] def does_match(string): stringl = string.lower() return any(s in stringl for s in searched) for row in reader: if any(does_match(col) for col in row): writer.writerow(row[:2]) # write only 2 first columns Re: Open CSV file and write new file Programming Software Development by karmstrong #!/usr/bin/python import csv import re #string_1 = ('OneTouch AT') #string_2 = ('LinkRunner AT') #string_3 = ('AirCheck') searched = ['OneTouch AT', 'LinkRunner AT', 'AirCheck'] def does_match(string): stringl = string.lower() return any(s in stringl for s in searched) … Re: Open CSV file and write new file Programming Software Development by Gribouillis You must take the time to understand the code. I wrote lowercase strings in `searched`. If you don't understand the code, it is a waste of time. Re: Open CSV file and write new file Programming Software Development by karmstrong Ok wait so it has to do with the fact I mixed case in the srings. Hmm. Ok let me try that. Yes you are correct I am a bit confused. Re: Open CSV file and write new file Programming Software Development by karmstrong Ok, you are right as soon asI change back to lowercase it works. I'm sorry but I'm not folowing I'm a bit confused. hmmm. Re: Open CSV file and write new file Programming Software Development by karmstrong Let me see if I am at least on the right track. searched = ['onetouch at', 'linkrunner at', 'aircheck'] Is defines an array of strings called search correct? I'm not sure what the significance of case is yet def does_match(string): stringl = string.lower() return any(s in stringl for s in searched)… Re: Open CSV file and write new file Programming Software Development by Gribouillis When the string is `"Wired Performance Testing ONeTouch AT"`, the first line in `does_match()` calculates the same in lower case: `"wired performance testing onetouch at"`. Then it checks if this string contains `"onetouch at"`, or any of the other substrings. This way ONeTouch AT gives the same result as OneTouch AT … Re: Open CSV file and write new file Programming Software Development by karmstrong Got it, that makes since now. One last piece here. I would like to print all the aircheck rows first then the linkrunner rows and finally the onetouch at rows. Out of curiousity how would you pic specific columns to print. Say I dunno column 1 and 5 or whatever? Someday I'll understand this :-) Re: Open CSV file and write new file Programming Software Development by Gribouillis To output the aircheck rows first, etc, one must store the rows as one examines them to determine which group they belong to. One can write searched = ['aircheck', 'linkrunner at', 'onetouch at'] # ordered def find_group(row): """Return the group index of a row 0 if the row contains searched[0]… Re: Open CSV file and write new file Programming Software Development by karmstrong Thank You so much. You have been a great deal of help. Do you happen to know of any good books on python or is the python documentation website about as good as it gets? Re: Open CSV file and write new file Programming Software Development by Gribouillis [Dive into python](http://www.diveintopython3.net/) is a well known free book online for beginners. The creator of python, [Guido van Rossum](https://en.wikipedia.org/wiki/Guido_van_Rossum) recently [reviewed](http://neopythonic.blogspot.fr/2013/10/book-review-charles-dierbach.html) and recommended another introductory book in his blog, if you want…