15,406 Topics

Member Avatar for
Member Avatar for Sohvkhan

As of this moment I have been switching back and forth between various iterations of my first foray into Python programming software, in any case part of my assignment calls for finding the count of even and odd numbers in a set of values that the user inputs, here is …

Member Avatar for sneekula
0
1K
Member Avatar for StarZ

This is a assignment I have to do for school. The program is about attack and defend. This is how it suppose to look like when it outputs: [url]http://i43.tinypic.com/bew6q.jpg[/url] Mine is basically done accept the part where it says "Your Health is:" the health is suppose to be "health = …

Member Avatar for jlm699
0
126
Member Avatar for sardarji

Hi, I am having trouble installing python 2.5/2.6 correctly on my linux box. I am trying to install in my home directory as I do not have root access. The poor python documentation in this regard makes it impossible to get this right. I want to install python in $HOME/local/lib …

Member Avatar for woooee
0
184
Member Avatar for StarZ

Starting on basic functions for python, and this is a assignment that I have to do... but I keep getting a Error.. but I tried, and still don't understand what is wrong. here is what it's suppose to output:[url]http://i39.tinypic.com/r1mv69.jpg[/url] This is what I've done: [code=syntax]def function1(french): print "Bonjour, comment allez-vous …

Member Avatar for lllllIllIlllI
0
108
Member Avatar for Blujacker

Is possible play waw, wma, mp3 with wxPython without oppening any window? Program will be based on Tk, only playing sounds on wx.

Member Avatar for lllllIllIlllI
0
1K
Member Avatar for eyewirejets

I would like to be able to display or print a count of the number of names that were inputted and display this when the user gets out of the loop by pressing any key other than "y". For example: Number of patients processed : 4 How could I create …

Member Avatar for eyewirejets
0
112
Member Avatar for jloyzaga
Member Avatar for vegaseat
0
854
Member Avatar for codedhands

Hello everyone,i really need help with this big problem(to me its big).The project am writing requires a panel to display its current status information on.I figured that i will need to make that panel scrollable because it will contain multiple lines of the text.My problem is i do not know …

Member Avatar for codedhands
0
2K
Member Avatar for breatheasier

Is there an easy way of doing this? for example my list is: [code=python] nlat=10 mylist = [] for x in range(0,nlat): for y in range(0,nlat): disk=sphere(pos=(x*s,y*s), radius = r, color=(0,1,9)) mylist.append(disk) [/code] or is it impossible to place objects, such as a sphere from vpython into a numpy array?, …

Member Avatar for breatheasier
0
687
Member Avatar for super zach

Hello all, I have a very rookie question to ask. I am using Pyraf, Python, Sextractor, & a sextractor wrapper to do some automatic photometry on celestial images. The following code I have written is used to extract info from a sextractor catalog such as image positions, image magnitudes, etc: …

Member Avatar for lllllIllIlllI
0
145
Member Avatar for Sohvkhan

Hello, I was assigned the task of coding this program in python for homework and I recently ran into a problem. Basically the assignment asks that a program prompt the user for a series of numbers and will then output the smallest number, the largest (their respective locations) and finally …

Member Avatar for woooee
0
155
Member Avatar for leegeorg07

i have this code: [ICODE]import webbrowser, random import os import os.path running = 1 DIR="C:/Documents and Settings/Owner/My Documents/georges poopy/main music/" music = filter(lambda x: x.lower().endswith("mp3"),os.listdir(DIR)) music = list(music) choice = int(raw_input("Press 1 to play a new song")) while running == 1: if choice == 1: song = random.choice(music) webbrowser.open(os.path.join(DIR,song)) choice …

Member Avatar for woooee
0
107
Member Avatar for lcc_551

Hi, I'm in first year computer science and could use some help on a program where I have to calculate the standard deviation from data on a txt file. Using some online help I've gotten somewhere but to be honest don't really know what's going on myself. The program is …

Member Avatar for jrcagle
0
189
Member Avatar for artmansoft

We have a Visual Basic script that communicates with an application through com. We like to translate it to Python and use win32com.client instead. We have everything working, except for the use of "Nothing" in the VB script for a couple of its function calls. What is the replacement of …

Member Avatar for jrcagle
0
1K
Member Avatar for Ene Uran

I am looking for a good example of the tarfile module, writing to and reading from an archive. Particularly the highly compressed filename.tar.bz2 format.

Member Avatar for BearofNH
0
154
Member Avatar for jmroach

So this should be a really easy one, but i've spent a few hours searching and can't find anything that explicitly states how to do this. All i want to do is see the column names for a particular table. I created the tables like: [CODE=python] con = sqlite3.connect( ":memory:" …

Member Avatar for weisburd
0
24K
Member Avatar for eyewirejets

Python 2.6.1: How would I write a user input validation statement scores < 0 or scores > 100 print error message and ask for input again? Where would I place it, in the below code? [CODE] num_test = raw_input("How many test would you like to average? ") scores = [] …

Member Avatar for sneekula
0
138
Member Avatar for lakhan.p

Hi, I m trying to open a file in read mode , my program is below ... #!/usr/bin/python print "------" file = open("C:\Lakhan\Pytonpro\file.txt", "r") print file file.close() but it shows following error ------ Traceback (innermost last): File "C:\Program Files\Python\Pythonwin\pywin\framework\scriptutils.py", line 165, in RunScript exec f in __main__.__dict__ File "C:\Documents and …

Member Avatar for lakhan.p
0
202
Member Avatar for mccraig

Hey all, I'm curious to know if there's a tkFileDialog that allows a person to browse for a folder, and in the pop-up "Browse for Folder" window, also have the option to "Make a new folder". I need to have this functionality, but when I use askdirectory() there is only …

Member Avatar for leegeorg07
0
1K
Member Avatar for amit1_x

I am new to Python, I have been asked to write a script to display the time difference. I get these times using shell scripts and are stored in some variables H1 and H2. I was wondering if i could use datetime.datetime in Python to calculate the difference the below …

Member Avatar for BearofNH
0
161
Member Avatar for eyewirejets

When I run my program, I get the word None as output for a line. I don't have a print statement that contains that word. When I debug no errors found. Any ideas what it can be?

Member Avatar for eyewirejets
0
96
Member Avatar for starzstar

Hi, I have a nested dictionary like the following how do I loop through such dictionary ,Basically I am looking to get the value of key "name" from the following dictionary Any help is appreciated, [{'resource': ['{"metadata": {"type": "directory", "size": "8"}, "name": "default", "links": {"link": ["{\\"href\\": \\"https://my.server.comdefault\\", \\"rel\\": \\"self\\"}", "{\\"href\\": …

Member Avatar for starzstar
0
121
Member Avatar for tobycatlin

Hello everybody, I am after a little help using python to read in data from a binary file. This is what i got so far: [CODE] import struct infile = "friday.bin" FH = open(infile, 'rb') line = FH.read(32) data= struct.unpack("<H", line[0:2]) print data [/CODE] Which produces an output: 38288 I …

Member Avatar for NarendraRoy
0
4K
Member Avatar for orangie

I would really appreciate a help to this problem: Let's say x = Class() x.name = 'the_name' x.value = 10 if you were only give the 'the_name' how do you get the instance ref, x to get x.value

Member Avatar for paddy3118
0
119
Member Avatar for rajasekhar1242

hi, i am trying to develop a database application. i am using python as front end and mysql as back end. But now i am getting some problem as "INTERNAL SERVER ERROR" while i am running my application on MAC OS x. #!/usr/bin/python import os import cgi from cgi import …

Member Avatar for rajasekhar1242
0
153
Member Avatar for gyu

hi i need help figuring out how to get my program to calculate standard deviation. this is what i've done so far: [QUOTE]import math import sys lines = sys.stdin.readlines() sample_number = 0 time_seconds = 0 time_list = [] for line in lines: time = line.split('\t') f2 = time[1].strip('\n') if time[0]!= …

Member Avatar for vegaseat
0
86
Member Avatar for mruane

Can you tell me where this unassigned global is...I looked everywhere but cannot find it. [code=python] global gold gold = 0 global a_gold_a a_gold_a = 15 global a_gold_b a_gold_b = 15 global a_gold_c a_gold_c = 20 global room1_done room1_done = 0 def prompt_main(): global a_gold_a, a_gold_b, a_gold_c, room1_done x = …

Member Avatar for vegaseat
0
93
Member Avatar for chebude

I want to read a file and convert the columns to rows. A 1 2 3 4 5 6 7 8 9 10 B 11 12 13 14 15 16 17 18 19 20 C 21 22 23 24 25 26 27 28 29 30 want them to be like …

Member Avatar for BearofNH
0
99
Member Avatar for TheOneElectroni

Hello everybody, I’m experimenting with PyQt, trying to learn it, and I’m a bit stuck with Signals and Slots. I don’t usually like just to repeat the examples you find in tutorials and guides because I think it’s more useful for learning to experiment concepts by yourself. Tutorials usually teach …

Member Avatar for TheOneElectroni
0
326
Member Avatar for vinoth_python

Hi, I'm doing python studies to write test automation scripts. As a part of that I want a script which should identify the NAT type of my network.. Please help me out in this regard... Thx.

Member Avatar for vinoth_python
0
104
Member Avatar for omni504

I'm not really sure if this is the right place or not for my questions, since i'm a complete noob when it comes to python and all. But its a real simple question, and help would be appreciated. I've been reading "Python for Software Design: How to Think Like a …

Member Avatar for omni504
0
154
Member Avatar for marcux

Hi all! I have made my GUI in Glade 3 with a couple of windows. When I click a button a window should show: [CODE]my_window.show()[/CODE] That works fine. If I close my window with: [CODE]my_window.hide()[/CODE] The next time I show the window it works fine, but if I close my …

0
89
Member Avatar for strobon

can someone pointing me how to get a command in checkbutton1 be executed after user check it and hit ok button?.for example: in the attached picture, if user check the 'open terminal button' and hit execute,the program open terminal window.

Member Avatar for strobon
0
130
Member Avatar for ITBarbie

I am writing a script (a full-fledged program, actually) in PYTHON (version 2.5; the current version is 3.0 but there are some performance problems -- 3.0 is slower than 2.5; go figure). The program allows a user to open a file in WORD. I have tested this program on an …

Member Avatar for leegeorg07
0
101
Member Avatar for 4pennies

Hello, a bit new to python here and would appreciate some help. I am writing a simple encoder to a raw_input(turn to numerical ascii and then applying some numbers to it). I was able to get the encoding right but when i try to do a outfile only the first …

Member Avatar for 4pennies
0
96
Member Avatar for drew7py

I am looking for some pointers on how to format float numbers in a numpy array. This code selects lines from an array, and I want the output to look better so I can import into excel. infile looks like this: 1074 CL 006 2004 A8LGPUYE 10 TY 2 S0111P …

Member Avatar for drew7py
0
113
Member Avatar for iLikeSunshine

Traceback (most recent call last): File "...\Hello Python\src\main\__init__.py", line 7, in <module> redBench.accomodate(harold) [B]TypeError: unbound method accomodate() must be called with bench instance as first argument (got man instance instead)[/B] Here is the code: [I]__init__py[/I] [CODE]import man_cl import bench_cl harold = man_cl.man("harold") redBench = bench_cl.bench [B]redBench.accomodate(harold)[/B][/CODE] [I]man_cl.py[/I] [CODE]class man: def …

Member Avatar for iLikeSunshine
0
74
Member Avatar for Rejinacm

When i used a global variable in my supplement file and imported it in a top-level file i got AttributeError.Why? eg: file1.py global i i =10 file2.py import file1 print 'i in file1 %d' %file1.i Aso,i was not able to use file1.i when i used from ie; from file1 import …

Member Avatar for Lardmeister
0
72
Member Avatar for istib

Dear all, I've been struggling with an issue whilst scraping a site that has both roman and arabic (and asian characters too, it seems). I want to extract those entries that are English, hence that don't contain foreign letters. I've been reading into some Unicode guides but can't get my …

0
44
Member Avatar for icu222much

I am trying to find a way to control the amount my variable 'i' increments by so I decided to include the code 'i = i + 1' within the for loop. My idea was that as my loop would run, it would print the 'i' values '1, 3, 5, …

Member Avatar for icu222much
0
205
Member Avatar for breatheasier

Hi, I'm making a program in VPython to simulate the motion of particles. It's fairly simple in theory but I'm having some problems with my lists of particles. What I'm trying to do is make sure that the particles do not overlap, and regenerate a position if they do overlap. …

Member Avatar for BearofNH
0
157
Member Avatar for RMartins

How can we in python change the number of elements in a line to the next, this is, for example... We have the following txt file: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 And we want a program which the output …

Member Avatar for woooee
0
93
Member Avatar for karthik.c
Member Avatar for scru
0
20K
Member Avatar for curiouskitten

i need help understanding how to fix my code (But please no explicit answers, I really need to understand.) I need to create a program (I'm using IDLE) that will count the number of characters in a given sentence WITHOUT counting spaces. So far I have: [CODE] S = raw_input("Enter …

Member Avatar for oldSoftDev
0
106
Member Avatar for beanryu

I start learning about python, so i read the tutorial: they show this: >>> x = int(raw_input("Please enter an integer: ")) Please enter an integer: 42 >>> if x < 0: ... x = 0 ... print 'Negative changed to zero' ... elif x == 0: ... print 'Zero' ... …

Member Avatar for breatheasier
0
2K
Member Avatar for sony_b

I am trying to write a python script that can take a word from one file and transfer it to a specific location in another file. for example, lets say i have a file called hb15b.txt and it includes the following: MODIFY-USER 2671, "hb15b01", " UGz9", 1, How can i …

Member Avatar for woooee
0
146
Member Avatar for Ene Uran

For the second year running Python has been selected as the Language of the Year by Linux users: [code] Linux Users' Programming Languages of the Year 2008 PHP 115 13.36% Perl 72 8.36% Python 226 26.25% Ruby 46 5.34% C 114 13.24% C++ 129 14.98% Java 106 12.31% Lisp 9 …

Member Avatar for breatheasier
0
147
Member Avatar for scoob_m

Hello, I have a code file from the boto framework pasted below, all of the print statements are mine, and the one commented out line is also mine, all else belongs to the attributed author. My question is what is the order in which instantiations and allocations occur in python …

Member Avatar for jrcagle
0
103
Member Avatar for mahela007

I want to copy some files using python. Can someone tell me how to use the shutil.copy() command properly? thanks

Member Avatar for Ene Uran
0
210
Member Avatar for MaxVK

Hi, I have written a nice little editor using the RichTextCtrl, and so far everything is working fine, however, for some reason the delete key does not work as expected. If I select something and hit delete then the selection is removed, but if I click anywhere in the text …

Member Avatar for MaxVK
0
131

The End.