15,406 Topics

Member Avatar for
Member Avatar for jaymeaux77

Hi, I am fairly new at the whole programming racket and I am having trouble with an assignment for my computer science class. I know homework help is discouraged, I read that sticky, but I'm curious if I am missing a fairly simple mistake. The assignment is to make a …

Member Avatar for jaymeaux77
0
224
Member Avatar for awn

Hi - I'm fairly new to python. I 've been trying to write some python code to read data from a serial port and convert it to be able to display as incrementing or decrementing numbers with a voltmeter image in the background. Any ideas on how i can flush …

Member Avatar for ov3rcl0ck
0
75
Member Avatar for CurtisEClark

[CODE]#Program to count number of specific vowels msg = input("Enter a message:") msg_lower = msg.lower() VOWELS = list(aeiou) msg_list = list(msg_lower) x = () for letter in VOWELS: x[letter] = msg_list.count(letter) for letter in x: print(a, x(letter)) print(e, x(letter)) print(i, x(letter)) print(o, x(letter)) print(u, x(letter)) [/CODE] I get an error …

Member Avatar for masterofpuppets
0
85
Member Avatar for gmilby

i setup a cronjob to execute a script (following instructions here [url]http://moinmo.in/WikiBackup[/url]) basically their script just opens a browser to a page with a backup button. after digging, i found i could add &do=backup and it would click the backup button for me, but now it just stops at the …

0
58
Member Avatar for elliottb

Hi, I'm trying to use swig to generate python wrappers to a custom binary package that my research group uses. I'm new to swig, but I must say I'm very impressed. The only hang-up I have left is that I have trouble directly accessing the global array data. I've currently …

Member Avatar for Gribouillis
-1
133
Member Avatar for DEATHMASTER

I'm just wondering how I would fix this [code]app = first[0:8] and second[0:8][/code] That doesn't work but if I remove "and..." it does but I need both.

Member Avatar for vegaseat
-1
219
Member Avatar for SuperMetroid

I'm compiling an extremely large list of usernames, and I want to know which is a faster method of checking what is already in the list. If anyone can give some insight as to how Python deals with each that would be much appreciated!

Member Avatar for vegaseat
-1
4K
Member Avatar for saikeraku

Hi, the program is this: Discount problem: Available deals: 10% off the total price when you buy $200 or more 15% off the total price when you buy $500 or more 20% off the total price when you buy $1000 or more Write a program that outputs the value, price …

Member Avatar for masterofpuppets
-1
153
Member Avatar for flebber

Hi I am continuing on with one of my first projects in python. This module for my larger project will be to download files(legal freely published by sporting assosciations). I am not sure if my concepts are right in how best to execute this, I have read the urllib docs …

Member Avatar for vegaseat
-1
161
Member Avatar for lewashby

In the code below, the only part I'M having trouble with is word[position]. I know this is something really simple but I've always had trouble understanding these kinds of statements. I know that it prints a random letter (position) from (word). What I don't know is why or how it …

Member Avatar for vegaseat
-1
119
Member Avatar for lewashby

In the program be below, I'M having trouble with these few lines, remember, I'M new. What's going on here? I'M just a little confused because there is (word) wraped in len(). [CODE]position = random.randrange(len(word))[/CODE] And what's going on with these two lines? Thanks. [CODE] jumble += word[position] word = word[:position] …

Member Avatar for snippsat
-1
169
Member Avatar for Dan08

Hey everyone, im doing a application, with some graphics in it and stuff nice in there, and to be honest is almost done. But when i run my program, a black window appears, just behind my program, its like a command prompt and what i would like to do is …

Member Avatar for vegaseat
-1
76
Member Avatar for minimagician

Hello All, Don't know if this is the right place to put this doubt. Help if possible. I have a python file that extracts data from a file and adds the required part to the database. Now MySQL has certain reserved characters, whenever my update query comes across a reserved …

-1
117
Member Avatar for GradStudent

Folks, I was trying to learn Python, I finished the basics,- Conditional Statements , loops, Functions, Classes. I want to try some GUI designing. I have downloaded Django. I use Python 2..6.2.. Where should i head next..

Member Avatar for lllllIllIlllI
-1
81
Member Avatar for mhangman

Hi im trying to write a game. Its very early stage but i hit to an error so need your help. Here the code: [CODE]def gexp(): connection = sqlite.connect('test.db') memoryConnection = sqlite.connect(':memory:') cursor = connection.cursor() cursor.execute('SELECT * FROM gain') expget = cursor.fetchone() exp = expget[1] texp = expget[1] + mexp …

Member Avatar for mhangman
-1
101
Member Avatar for aegis042404

Hi, I'm writing a little learning game for young kids, mostly to help my own girl learn a few things. I've chosen colours first, but hope to adapt it for more complex ideas later. I'll be releasing it GPL3, if I ever get it done, so feel free to reuse …

Member Avatar for lllllIllIlllI
-1
232
Member Avatar for neverlander

I am trying to display a gif file on pyqt.It shows but doesnt animate.It is static.How can make it animate? This is the code i used: [CODE]pic=QtGui.QPixmap("./IRREGULAR/"+ui.lineEdit.text()+".gif") ui.label_9.setPixmap(pic)[/CODE]

Member Avatar for vegaseat
-1
5K
Member Avatar for MichelleCrews

hey, ima first time programmer and i no clue whats going on someone please help!! i have to write a function called number_of_2s that includes one parameter, N, where N is a positive integer that is no more than 10 digits long. the function should return the number of times …

Member Avatar for MichelleCrews
-1
105
Member Avatar for ihatehippies

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 …

Member Avatar for Gribouillis
-1
121
Member Avatar for oasuspender

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)

Member Avatar for vegaseat
-1
98
Member Avatar for mohankumar554

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 …

Member Avatar for vegaseat
-1
855
Member Avatar for DMcQuinn

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?

Member Avatar for vegaseat
-1
15K
Member Avatar for vegaseat

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.

3
734
Member Avatar for x3277789

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 …

Member Avatar for ov3rcl0ck
-1
260
Member Avatar for gerard4143

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 …

Member Avatar for ov3rcl0ck
-1
531
Member Avatar for jasonehoss

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 …

Member Avatar for jasonehoss
-1
99
Member Avatar for scrace89

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 …

Member Avatar for scrace89
-1
161
Member Avatar for johnchery

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 …

-1
42
Member Avatar for walker164

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 …

Member Avatar for walker164
-1
150
Member Avatar for lukerobi

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 …

Member Avatar for lukerobi
-1
85
Member Avatar for kingofkya

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 …

Member Avatar for kingofkya
0
2K
Member Avatar for casidiablo

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 …

0
31
Member Avatar for redpython

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 …

Member Avatar for redpython
0
191
Member Avatar for Todd88

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 …

Member Avatar for vegaseat
0
127
Member Avatar for khaos64

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 …

Member Avatar for khaos64
0
273
Member Avatar for broberts_az

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 …

0
62
Member Avatar for JustAnotherJoe

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 …

Member Avatar for xav.vijay
0
196
Member Avatar for totaltmega

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 …

0
55
Member Avatar for CurtisEClark

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 …

Member Avatar for vegaseat
0
242
Member Avatar for chico2009

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 …

Member Avatar for ov3rcl0ck
0
279
Member Avatar for adam291086

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 …

Member Avatar for ov3rcl0ck
0
104
Member Avatar for pysup

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 …

Member Avatar for ov3rcl0ck
0
4K
Member Avatar for Joe Hart

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

Member Avatar for Joe Hart
0
177
Member Avatar for Seagull One

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 …

Member Avatar for Seagull One
0
571
Member Avatar for vextorspace

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 …

Member Avatar for vextorspace
0
279
Member Avatar for Lamb_Chops

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 …

Member Avatar for lukerobi
0
62
Member Avatar for vanand

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 …

Member Avatar for vanand
0
99
Member Avatar for jtabak2

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 …

Member Avatar for jice
0
165
Member Avatar for romes87

Hi, I am trying to do a simple task in Python but I keep getting error. I have a string stored in a variable and a simple GUI with a button (in 1st.py) which will call another function in a separate file (twond.py) which will split that string and store …

Member Avatar for romes87
0
4K
Member Avatar for alex-VX

I´we been crazy looking on google after this the protocol function won´t work I need to make something happen at those events WM_QUERYENDSESSION WM_ENDSESSION WM_QUIT WM_DESTROY WM_CLOSE Thanks for help yours truly Alexander

Member Avatar for alex-VX
0
298

The End.