15,175 Topics
| |
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 … | |
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 | |
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 … | |
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) … | |
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 … | |
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 … | |
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"] … | |
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, … | |
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 … | |
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. … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 ...... | |
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... | |
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 | |
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 … | |
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. | |
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 … | |
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. | |
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 … | |
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 … | |
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, … | |
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 … | |
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", … | |
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 … | |
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 | |
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 … |
The End.