15,181 Topics
| |
What is the consensus on the best way reference module level variables? I have a wx app that has grown too large, so I started to do some housekeeping. I'm trying to move several functions outside of the main module while still being able to reference the main variables.. The … | |
Here is my code but getting a error Learning Python Code needed ask user number miles driven, gallons of gas used caluculate car mpg display result? miles_driven=raw_input("How many miles have you driven?\n") gallons_of_gas_used=raw_input("Now how much gas have you used?\n") print int(miles_driven) / int(gallons_of_gas_used) | |
hi i am developing web services on MAC SYSTEM by using python-SOAP-ZSI tool. but i am getting this error when i am trying to install. so it is not working . so can u tell me how to overcome this error. "SyntaxError: from __future__ imports must occur at the beginning … | |
I want to loop from 0 radians through 6.2 radians in increment of 0.1 radian something like this in C for(r=0.0; r<6.4;r=r+0.1) this is the best I can do in Python: for i in range(63): z = float(i)/10 print z Is there a better way? | |
An example of a range generator that handles floating point numbers, appropriately called frange(). The function range() or the generator xrange() can only be used for integers. Note that xrange() now is range() in Python3. | |
Hi Everyone, So i have been trying to figure this out for ages. Im just not able to to get the algorithm straight. Say I am given a string containing markup tags ex. <html> </html> in a string like this: <html> <head> <title> Example </title> </head> <body> quiet <CAPSLOCK> LOUD … | |
Hi everyone, I recently installed Slackware 13/x86_64 on one of my boxes and now I'm having troubles with Python code that uses threading and Tkinter. This problem never existed on other Linux distro's, it just appeared with Slackware. The box in question Acer Athlon x86_64 single core used to run … | |
What I would like to do is to check the size of an archive directory in each of our users folders accessible via a Windows machine. I have a txt file with all of the users names (1 per line) and am trying to use for loops and potentially readline … | |
This is only the 2nd program I've ever worked on and I am stuck right off the bat. Our teacher wrote some of the code for us. We just need to call a function for each section of classes, where we remove the spaces between the classes (for example: CMSC … | |
To parse an input text file and generate a) an XML file and b) an SVG (also XML) file. The input text file (input.txt) contains the description of a number of produce distribution centers and storage centers around the country. Each line describes either a single distribution center (dcenter) or … | |
| Hi everyone, I'm working on a homework assignment and i'm brand new to python (i'm a better c++ coder). Anyway, I've used help from classmates and google to compile this code chunk and i need to know how i can make this into a loop so i dont have 26 … |
lets say i have a list: L = [1,2,3,4,5,6,7,8,9] x could be anything, but it wont ever be longer than len(L) - 1.. just for what im asking, im setting it to 3 x = 3 value could also be anything, but not exceeding sum(L) value = 8 What i … | |
Ok my script takes a list of files picks out all jpgs and stores it in files[] now the problem is how do I display all thous images in tk gui window below is what i have that works for 1 image how do i make this work for basically … | |
Hello there.... I've been wondering whether there is a simple way to retrieve system info, I mean, how much RAM the computer has, what's its CPU usage, etc. I need to do it multiplatform, but I guess I'll have to make different things on each OS. I was looking for … | |
I have a text file (tackles.txt) that contains basic stats on high school football players - so far it is just last name and number of tackles. For example: Jones 2.3 Smith 4.6 Dillon 7.8 How can I read that file and come up with the average number of tackles … | |
I am writing a project with two classes: 1 factory class and 1 "fragment" class. The factory class creates fragments from a given input file. For example, if there was a file that was 100 bytes in size, the factory class would create 10 fragments of 10 bytes each. The … | |
| Ok, I'm pretty new to Python.... What I need to do is set up a couple tuples like so: [CODE]users = ('user1','user2','user3') passw = ('pass1','pass2','pass3')[/CODE] I then am asking the user for their username and password to compare to the tuples. The only way I could think to do that … |
Does anybody out there know how I could take a Python geoprocessing script that was made in ArcGIS and use it for an external GUI? There are a lot of limits to what can be done inside ArcGIS and the scripts only make basic input/output GUI. I have messed around … | |
Following the example of 'cx-freeze hello.py', I'm getting the error message below. I put all of the error keywords into google and found no hits. Some people in various posts have said to use Python 2.5 but a lot of my code is using Python 2.6 features. Can you telling … | |
hello, I have an python script that uses and starts an base http server, in the web interface i have made an textbox and an submit button. and i would like to get the value from the text box to overide an varriable value in the python script. i have … | |
We are creating a loop in my CSET class and I am stuck. This is the original script I created: [code=python] #This is a game character health simulator health = int(input("What is your characters health?")) if health <0: print("Dead") elif health >=0 and health <100: print("Weak") elif health >100 and … | |
Hi I am having problems using the readline command, I get an alarm lineA = fin.readline[lpa].strip() # Read line indicated by pointer a and delete CR TypeError: 'builtin_function_or_method' object is unsubscriptable when trying to run this code I tried removing the strip component and that didnt help. Some help would … | |
i am trying to set a cookie with TG2 like [CODE] cookie = Cookie.SimpleCookie() cookie["ADAM-TEST"] = "random.randint(1000000000)" cookie["ADAM-TEST"]["domain"] = ".jayconrod.com" cookie["ADAM-TEST"]["path"] = "/" cookie["ADAM-TEST"]["expires"] = \ expiration.strftime("%a, %d-%b-%Y %H:%M:%S PST")[/CODE] When i do the following [CODE] print "Content-type: text/plain" print cookie.output() print print "Cookie set with: " + cookie.output()[/CODE] i … | |
Hi All, I need to open a exe from python. For ex i used [CODE]import os os.system("C:\Winamp\Winamp.exe") [/CODE] but I need to open an exe from the "Program Files" directory. I get an error because of the space between "Program" and "Files". [CODE]import os os.system("C:\Program Files\Winamp\Winamp.exe") >>'C:\Program' is not recognized … | |
I have a text file that I need to find data and assign it to a variable. I have found code to read and search a file but the information I want is not always constant. The Items in Red will change. Is there a way to find this information, … | |
I'm writing some code for my robot's stereoscopic vision. This is how I'm calculating the stereo vision in python (I'm using the roborealm API). [CODE=python]COGXR = rr.GetVariable("COG_X_RIGHT") COGYR = rr.GetVariable("COG_Y_RIGHT") COGXL = rr.GetVariable("COG_X_LEFT") COGYL = rr.GetVariable("COG_Y_LEFT") Z_Actual = (11 * 5.5)/COGXL-COGXR X_Actual = (COGXL*Z_Actual)/(5.5) Y_Actual = (COGYL*Z_Actual)/(5.5)[/CODE] Whenever I run … | |
when using the data_files option in my setup.py #!/usr/bin/env python import ctypes from OpenGL.platform import win32 from distutils.core import setup import py2exe import sys sys.path.append("dist") setup(options = {"py2exe": {"compressed": 1, "optimize": 2, "includes": ["ctypes","Tkinter","Numeric"], "excludes": ["OpenGL"] }}, zipfile = None, data_files=['msvcr71.dll', glut32.dll'], windows=['myprogram.py'] ) I get an error saying msvcr71.dll … | |
I can't for the life of me solve this problem :icon_confused: Write a function called rand_goodbye(name) that returns (not prints!) a string that says goodbye, where the goodbye phrase is chosen at random from these three possibilities: * Goodbye name * See ya' later name * name: stay cool! I'm … | |
| Hi all, I would like some advice as to how to go about this particular problem that I am facing. I have three computers involved in this problem: There is a real time DATA SERVER. The problem with DATA SERVER is it is located inside an internal private network. So … |
I am relatively new to python, and have run into an issue with reading a strangely formatted output file. The current format of the output file for each line is [(x,y),.....(x,y)] (tuples nested within a list?) and I need to read each line in the file and output a 3 … |
The End.