15,185 Topics

Member Avatar for
Member Avatar for YasaminKh

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 …

Member Avatar for YasaminKh
0
193
Member Avatar for kosco

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 …

Member Avatar for vukman
0
285
Member Avatar for shannonkr

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 …

Member Avatar for TrustyTony
0
74
Member Avatar for ihatehippies

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 …

Member Avatar for snippsat
0
11K
Member Avatar for haro2x

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 = …

Member Avatar for haro2x
0
149
Member Avatar for echellwig

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

Member Avatar for echellwig
0
574
Member Avatar for YasaminKh

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 …

Member Avatar for TrustyTony
0
330
Member Avatar for YasaminKh

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 …

Member Avatar for YasaminKh
0
182
Member Avatar for cableguy31

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 …

Member Avatar for cableguy31
0
81
Member Avatar for SoulMazer

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 …

Member Avatar for SoulMazer
0
108
Member Avatar for gsingh2011

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 = …

Member Avatar for Beat_Slayer
0
246
Member Avatar for aframe

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 …

Member Avatar for griswolf
0
2K
Member Avatar for patto78

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. …

Member Avatar for patto78
0
208
Member Avatar for heyday21c

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 …

Member Avatar for vegaseat
0
1K
Member Avatar for TrustyTony

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 …

Member Avatar for TrustyTony
0
1K
Member Avatar for ChargrO

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.

Member Avatar for TrustyTony
0
140
Member Avatar for daviddan2010

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 …

Member Avatar for daviddan2010
0
2K
Member Avatar for mastermoo420

[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:

Member Avatar for TrustyTony
0
62
Member Avatar for ChargrO

I was wondering if anyone knows how to create a transparent background image? just a small example or something.

Member Avatar for colorpie
0
138
Member Avatar for kshw

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)) …

Member Avatar for woooee
1
209
Member Avatar for debragail

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 …

Member Avatar for debragail
0
180
Member Avatar for foren

[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

Member Avatar for foren
0
236
Member Avatar for muthukumarangms

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 …

Member Avatar for muthukumarangms
0
3K
Member Avatar for cbtetech

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 …

Member Avatar for TrustyTony
0
307
Member Avatar for jonb7

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 …

Member Avatar for SoulMazer
0
114
Member Avatar for funfullson

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.

Member Avatar for jcao219
0
86
Member Avatar for cableguy31

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 …

Member Avatar for TrustyTony
0
145
Member Avatar for Priyesh_17

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 …

Member Avatar for TrustyTony
0
127
Member Avatar for cadtel

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 …

Member Avatar for TrustyTony
0
191
Member Avatar for Pykoda

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 …

Member Avatar for TrustyTony
0
123

The End.