15,185 Topics
| |
I need to do some math operation in my code. I'm doing something like this: [CODE] kapaerror_list[i] = sqrt(4*((LDerror_list[i])**2)*((LDmean_list[i])**2) - (error_list[i])**2) print "%s\t%g\t%g\t%g\t%g" % (indexvalue_list[i],mean_list[i],kapa_list[i],LDmean_list[i],kapaerror_list[i]) [/CODE] but i'm getting the following error: print "%s\t%g\t%g\t%g\t%g" % (indexvalue_list[i],mean_list[i],kapa_list[i],LDmean_list[i],kapaerror_list[i]) TypeError: float argument required The funny thing to me is that when i erase … | |
Hi, I am simulating wireless networks and the simulator keeps putting runtime data to the output and eventually to my results file. to give you an idea .... 1 8724593564 2 153 465 1 8725120550 14 900 259 Node 0 sends packet to 1 1 8725375953 22 654 339 1 … | |
I need to take the element from a list and use them as the input for the rest of my script. Right now I have it set up with a raw_input and I have to enter numbers in sequence and the script runs. I would like the computer to do … | |
In order for my code to be efficient, loops need to be terminated prematurely to prevent unnecessary iterations. I know that list comprehension is fast that the 'for' statement, but I'm having trouble finding a suitable way to break them. Here's what I've come up with [CODE=python]try: [x if x … | |
Hello I have made a simple gui tic tac toe game using glade and python 2.6/ Now I want to change the text of the button when i click it. Does anyone know how to do this?? code: [CODE]#!/usr/bin/env python import gtk import gtk.glade import sys class iksoks: wTree = … | |
Hi, I'm trying to replace an item in a list I made with 0. [CODE]popdata[0][5].replace(0.02,0)[/CODE] when I run this it gives me the error TypeError: expected a character buffer object. I was wondering what this error meant and how I would go about fixing it. Thanks! Elise | |
Hi, I'm new to programming and especially to Python. I have this xml file that has parts like this: <VECTOR_AVERAGE name="Density Correlations" nvalues="15625"> <SCALAR_AVERAGE indexvalue="( 1,2,0 ) -- ( 3,4,5)"> <COUNT>204160</COUNT> <MEAN method="jackknife">6.368e-05</MEAN> <ERROR converged="yes" method="jackknife">2.89e-05</ERROR> <VARIANCE method="simple">6.37e-05</VARIANCE> <AUTOCORR method="jackknife">0.843</AUTOCORR> I need to save MEAN and ERROR. I wrote the … | |
Hi, I'm working with an xml file in python.here is the coed that i have: [CODE] import sys from xml.dom.minidom import parse # Load XML into tree structure tree = parse(sys.stdin) #Find all VECTOR_AVERAGE nodes va_list = tree.getElementsByTagName('SIMULATION')[0].getElementsByTagName('AVERAGES')[0].getElementsByTagName('VECTOR_AVERAGE') #Find the 'Density Correlations' node in the list of VECTOR_AVERAGEs for va … | |
I'm using re.search to search for the pattern of anything that might look like a credit card number in a file. What I would like to do, is have the script then pull out the potential cc number and pass it to the Luhn algorithm for verification. If I'm not … | |
Hi, I'm writing a program that goes through all of the music in a user-specified directory and I am having some trouble with Unicode characters. More specifically, [icode]'ascii' codec can't encode character u'\\xe7'[/icode]. The song names need to both be printed to a HTML page as well as be passed … | |
I need to log in to a website using python. The two fields are username and password. This is what I have tried: [CODE]import urllib import urllib2 import httplib username = "username" password = "password" url = "https://webconnect.bloomfield.org/Zangle/StudentConnect/logincheck.aspx" password_mgr = urllib2.HTTPPasswordMgrWithDefaultRealm() password_mgr.add_password(None, "https://webconnect.bloomfield.org/Zangle/StudentConnect/", username, password) handler = urllib2.HTTPBasicAuthHandler(password_mgr) opener = … | |
I have a python script using Tkinter. In the script I have a numeric variable that the user is able to change the value of by entering the value in an entry box. I presently have the script reading and writing the value to an external .txt file so when … | |
Hi, I've just paid £10 for a book on the internet with the sole intention of solving one problem, unfortunately 2.5 hours later I am no further forward, despite the fact that the book suggests just a single line of code can achieve my aim. Maybe someone here can help. … | |
Hello, I want to count phrases in a text file by using Python. For instance, if a text is like "I love you very much", I want to make a dictionary like: "I love": 1, "love you": 1, "you very": 1, and "very much": 1. I also want to do … | |
The code from my answer to thread: [url]http://www.daniweb.com/forums/thread292949.html[/url] Any field names with any same separator separating the values. This is straight text file reading routine, see the original thread for csv module based code. sample.dat: [CODE]id; name; email; homeaddress 123; gishi; gishi@mymail.com; 456 happy st. 345; tony; tony.veijalainen@somewhere.com; Espoo Finland … | |
hi, im currently making a food ordering system in python. I recently decided to put a background in the window and now all of my buttons have disappeared?? does anyone know why this might be. | |
First i'd like to say that this is for testing only. If you try to use this program for any illegal practices what so ever... you will be responsable for your actions and i will be responsable for nothing. you would need some kind of security code generator to illegally … | |
[url]http://paste.pocoo.org/show/231731/[/url] My problem is listed here... There shouldn't really be a reason (as far as I can see) with memory... If there's another way to get a dictionary from a .txt file that'd work/is more efficient, I'm looking for help. P: | |
I was wondering if anyone knows how to create a transparent background image? just a small example or something. | |
Hi, I'm trying to remove non-stop words from a text file using regular expresions but it is not working. I used something like ('^[a-z]?or') in order to avoid removing (or) from the mibble of words e.g. morning. [code] Temp = [] Original_File = open('out.txt', 'r') Original_File_Content = Original_File.read() Original_File.close() Temp.append("".join(Original_File_Content)) … | |
The following code iteratively calculates continued fractions. I'm having trouble separating the numerator and denominator from the returned value. [code=python]def cf3(terms, iterations): answer = 0 for n in range(iterations, 0, -1): answer = Fraction(1, terms[n] + answer) answer += Fraction(terms[0], 1) return answer [/code] The following is sample output showing … | |
[CODE]output = open('d:\code\\output.txt','w') for y in range (0,len(evidence_array)): output.write(evidence_array[y] + ', ' + found[y] + '\n') #I am not sure if this output writing is correct! output.close()[/CODE] PLEAE CAN SOMEONE HELP! ---I AM NOT SURE IF THIS OUTPUT WRITING IS CORRECT THANKS | |
Hi, I am trying to run a installer file that is compiled in python 2.5 on fedora 10 to the new upgraded python 2.6 on fedora 13 while trying to run the installer file this error occurs RuntimeError: Bad magic number in .pyc file The pyc files are compiled in … | |
Hello and thanks for any assistance, I wrote this basic script to batch make test forms for a side project. In its current state it works fine and I can pass file names to it no problem. It will take the form embeded in the code and create 10 additional … | |
Hi , I am trying to run a Python script from linux but i am unsure how to do this. Reason being is i have created an Active Directory script to list users in groups and it works perfectly on windows but i need to move this to the linux … | |
Hi dears. I am searching around a reporter for python. some thing such as crystal_report or stimul_report witch used for C# and some languages other. thanks. | |
I'm writing a script that will search file names looking from certain file extensions. The thing is, is that I am looking for multiple extensions, and the list may change. I could write an if statement using "and", but the line just gets a bit long and can become difficult … | |
Hi All, I am a newbie in python. I have a SoapUI XML which looks something like this <soapui> <testSuite name=> <testCase> <testStep> <config resourcePath ="testpath"></config> </testStep> </testCase> </testSuite> </soapui> Now from python, I have to first validate that resourcePath is equal to "testpath". If yes change it's value to … | |
Hi all, this is my first post. A couple days ago, in preparation for a math final, I attempted to code a program which would allow me to solve triangles (law of cosines, sines, etc.). Now that the test is over, I am now interested in getting it working. [CODE]#This … | |
Hello everybody ! wow my first time on danyweb ! ;p Well, here the deal. Im doing a script that basically copy and past into the local drive a specified directory with all this files. Im doing the copy with a copytree which is working well. But, (and I know … |
The End.