15,175 Topics

Member Avatar for
Member Avatar for katamole

Hi there, I've been searching the documentation but I can't find any answers (perhaps I'm asking the wrong questions). Say we have a list of animals: Sheep, Cow, Pig, Horse. All of these animals have attributes (4 legs, etc.) We have the name of the animal and the attributes stored …

Member Avatar for katamole
0
399
Member Avatar for taboyo22

How do you get programs like bubble sort, quick sort to print a result. def bubblesort(list): for passes in range(len(list)-1, 0, -1): for index in range(passes): if list[index] < list[index + 1]: list[index], list[index + 1] = list[index + 1], list[index] return list Thanks

Member Avatar for jlm699
0
84
Member Avatar for max.yevs

say you have a list, b, you don't know how many items are in there, but how could you add up all the items? for example, if your list is [2,4,5,8,10] is it possible to find the sum of all the numbers? so it will give you 29? i've been …

Member Avatar for max.yevs
0
80
Member Avatar for muhammadammar

I am working on a script which uses subprocess and multiprocessing modules, the problem is that when i try to kill a process it said that WindowsError Access is Denied Here is the problem in detail def function1(file, childConn): some statements def fuction(): process1 = subprocess.Popen(process1_path, 0, None, None, None) …

0
49
Member Avatar for max.yevs

this is kind of a quick question, but just a bit complex: say i want it to find n in range(5), i would do this: [code]for n in range(5): print n[/code] and it would return 0,1,2,3,4.... but what if instead of returning i want it to put it in a …

Member Avatar for max.yevs
0
106
Member Avatar for seamonkie

I am having problems with this code and im nooby what im trying to do Create a game where the computer picks a random word and the player has to guess that word. The computer tells the player how many letters are in the word. Then the player gets five …

Member Avatar for jlm699
0
776
Member Avatar for henryxxll

I created a Python script to find two whole numbers that, when multiplied together, will equal the target number, or factors. My script works by dividing the target number by a regularly increasing integer, and checking to see if the quotient is a whole number (integer). Here's the script: [CODE="python"] …

Member Avatar for woooee
0
132
Member Avatar for max.yevs

i'm making a program, i need to know is there a command for "divisible"? as in [code]if m is divisible by n[/code] if not, is there a command like "if its a whole number"? as in [code]if m is a whole number[/code] of course i can work with either command, …

Member Avatar for max.yevs
0
303
Member Avatar for shiva666

hello to all i need help getting the output of this program to write into a file elif choice == "3": print "all users list :" print"\n" import active_directory for user in active_directory.search ("objectCategory='Person'", "objectClass='User'"): print user "" that lists all active directory personal .. in rows how can i …

Member Avatar for shiva666
0
61
Member Avatar for tivrfoa

hi!! to show the source code I thought it is supposed to do this (at least it worked using ipython with version 2 of python): >>> method?? I'm using version 3. How can I show the source of a method. eg: >>>def sayHi(): print('Hi') >>>sayHi?? then show the source code. …

Member Avatar for vidaj
0
181
Member Avatar for invinate

Hello, I start a thread that runs exec and sets the global variable to True, meaning that the thread finished. The main thread that creates this new thread runs in a loop while the global var is False. The problem is that the exec job is also running in a …

Member Avatar for invinate
0
81
Member Avatar for blair.mayston

Hi, Playing with a script I did a while ago that sends emails alerts when rss feeds are updated to make it more readable, and have struck a problem. At present the email it sends is formatted as follows: "http://www.stuff.co.nz/national/2344448/Group-charges-in-to-reduce-bag-use" Group charges in to reduce bag use (Pressure from environmentalists …

Member Avatar for blair.mayston
0
16K
Member Avatar for maybetuesday

Hi I'm having some trouble with my code. In my code, I've designed a frame with a checked box inside using wx.Frame and wx.CheckBox. I'm trying to allow users to decide whether they want to grayscale a list of images. If the user checks the box, wx.ProgressDialog is launched. All …

Member Avatar for lllllIllIlllI
0
193
Member Avatar for daviddoria

Does anyone have a good 2 line summary of WHEN to use perl/python/bash/etc? To do easy-ish things, they can clearly all be used, but there is likely an ideology behind each that indicates WHEN/WHY to use them. For example, I use VB if I want easy GUI, c++ if I …

Member Avatar for leegeorg07
0
134
Member Avatar for max.yevs

so i was trying to make a very simple counter (although not sure if that's what you call it) [code]import time a = 0 def main(): time.sleep(5) b = a + 1 print (b) del(a) a = b del(b) main() main()[/code] i know this is very unefficient and there is …

Member Avatar for max.yevs
0
134
Member Avatar for khozamtho

how to compile and run a python file,and how to change a directory in Python25.what should i import first in order to run a python code.like import math and ......

Member Avatar for woooee
0
205
Member Avatar for rajasekhar1242

Hi everyone, I am trying to get PDF file output from the python program to give a print. is there any solution? please give me a valuable reply...

Member Avatar for woooee
0
207
Member Avatar for bhanu1225

Hello everyone I have created [COLOR="Red"]Tkinter application on Mac OS X.[/COLOR] [COLOR="Green"]I need to take printout for the output of that program from that application only.[/COLOR] Kindly please give me a valuable response. Regards BHANU

Member Avatar for scru
0
114
Member Avatar for ning2009

Hi, there my code is below [ICODE] resultlines=[targetlines[0] % dResult['SEC'], targetlines[1] % line1b, targetlines[2] % (section_type,dResult['SEC'],mat_data), targetlines[3] % section_data, targetlines[4] % (math.sin(float(dResult['ANG'])*math.pi/180), math.cos(float(dResult['ANG'])*math.pi/180), 0)] for line9 in resultlines: line9=line9+"\n" binf.write(line9)[/ICODE] , which generated the format with empty lines below *beam section,section=I,elset=UC356X368X202,material=STEEL 0.1873,.3746,.3747,.3747,.027,.027,.0165 1.000000, 0.000000, 0.000000 *element,type=b31,elset=LCHS965-14-3 39,3490,1612 *beam section,section=PIPE,elset=LCHS965-14-3,material=S355 0.4825,.0143 …

Member Avatar for amitattri1987
0
412
Member Avatar for tivrfoa

Hi! I'm using IDLE. [CODE]Python 3.0.1 (r301:69561, Feb 13 2009, 20:04:18) [MSC v.1500 32 bit (Intel)] on win32 Type "copyright", "credits" or "license()" for more information. >>> test = 1 >>> if test: print "ok" SyntaxError: invalid syntax (<pyshell#2>, line 2) >>> [/CODE] Does someone can help me? Thanks.

Member Avatar for tivrfoa
0
171
Member Avatar for smb3d

Hi, I've written a python cgi app that lists image files in a directory then when the user clicks on a link it converts the image to a .jpg and displays it in a simple html page. I'm using tempfile.NamedTemporaryFile to create a temp file that the converter can write …

Member Avatar for smb3d
0
149
Member Avatar for Crinkly

Can the edit wizard be altered to allow more than 4 packs to be used? Now more of us use large screens more than four can be useful.

Member Avatar for Crinkly
0
79
Member Avatar for max.yevs

i made another extremely simple script, but i've looked through all the random python commands(10.6) and can't figure out how can i write a nonunique random script? as in all the random numbers can be the same? like random.sample? say i have a list [1,2,3,4] and i want to pick …

Member Avatar for max.yevs
0
122
Member Avatar for max.yevs

yet another quick question... I wrote this at the end of a script [code]y = 1 n = 0 i = input("Again? Y/N: ") if i is 0: print ("Good bye!") exit if i is 1: execfile ("program2.py")[/code] now of course if i is 0, they won't be able to …

Member Avatar for adam1122
0
105
Member Avatar for txwooley

I am working on a function to find the slope of a line if given x1, y1 and x2, y2. Not too hard. But I need the results to be floating point not integers even though the x and y inputs are integers. I have : [code=python] def slope(x1, y1, …

Member Avatar for txwooley
0
131
Member Avatar for jworld2

I have been looking for a way to compile my [B]whole[/B] program into a single executable file that can be run completely by itself. That also includes any image files that my program uses. Something like when the executable is run, all extra files are extracted into a temporary directory …

Member Avatar for jworld2
0
130
Member Avatar for ning2009

Hi, there I have the code (from Jice) using List below [CODE=syntax] targetlines=["*beam section,section=%s, elset=%s, material=%s", "%s", "%f, %f, %f"] resultlines=[targetlines[0] % (dResult['SEC'],section_type,mat_data), targetlines[1] % section_data, targetlines[2] % (math.sin(float(dResult['ANG'])*math.pi/180), math.cos(float(dResult['ANG'])*math.pi/180), 0)][/CODE] , which worked well However when I modified it to [CODE=syntax] targetlines=["*element,type=b31, elset=%s", "%s", "*beam section,section=%s, elset=%s, material=%s", "%s", …

Member Avatar for ning2009
0
92
Member Avatar for -obol-

Hey everybody im a real newbee at python and im just wondering how to split a string of words into pieces and print on separate lines for example: " sun is shining" to: sun is shining i know this might be a simple task for a lot of people but …

Member Avatar for jlm699
0
265
Member Avatar for Mearah

Hey, is there somebody who tried to use pyOpenGL with wxPython? I want to have a GUI, where I have a frame integrated, that shows a 3D image computed by an OpenGL algorithm build in the PyOpenGL environment. Mearah

Member Avatar for Mearah
0
662
Member Avatar for max.yevs

so i was trying to make a very simple counter (although not sure if that's what you call it) [code=python]import time a = 0 def main(): time.sleep(5) b = a + 1 print (b) del(a) a = b del(b) main() main()[/code] i know this is very unefficient and there is …

Member Avatar for adam1122
0
143

The End.