15,181 Topics
| |
Hi, I'm looking to break up a file with space delimiters. Its really just a list of numbers with spaces in between them, and I need to put each of the numbers in a list as separate entries. However, they are all on one line like so: 5 7 6 … | |
[CODE]from Tkinter import * import pygame.mixer sounds = pygame.mixer sounds.init() correct_s = sounds.Sound("Correct.wav") wrong_s = sounds.Sound("Wrong.wav") number_correct = 0 number_wrong = 0 def play_correct_sound(): global number_correct number_correct = number_correct + 1 correct_s.play() def play_wrong_sound(): global number_wrong number_wrong = number_wrong + 1 wrong_s.play() app = Tk() # creat a tkinter application … | |
Hello, I am trying to sum lists if a condition is met, not working, not sure why, I end up with PN=[0,0,0,0,0,0,0,0] which is it's initial condition and should be PN=[1,1,1,1,0,1,1,1] as PN0 and PN1 satisfy the condition PNi.count(1)<2, so PN+PN0+PN1 = [1,1,1,1,0,1,1,1]. Thanks. [CODE]>>> PN0=[0,0,1,1,0,1,0,1] PN1=[1,1,0,0,0,0,1,0] PN2=[0,0,0,0,1,0,0,0] PN=[0,0,0,0,0,0,0,0] NULL==[0,0,0,0,0,0,0,0] … | |
As I started to mention in this thread [URL="http://www.daniweb.com/forums/thread293034.html"]Checking for filetypes?[/URL]: I'm writing a script that will search files that contain certain keywords, and then output the line to a text file. The problem I'm having is that the script is opening every type of file, including executables. The script … | |
The wxPython GUI toolkit makes a very nice plotting component/widget available. You can select line or marker plotting, or a combination of both. All you have to supply is a list of x,y point tuples. Other features include zooming and printing. | |
atlast I have managed to get some working code but the first problem is that I have is taht.. when I call draw(2,4) I have a column of 2 circles and 4 rows and I would actually like it to be a clomun of 2 and row of 4. Secodly … | |
Hello, can someone please tell me why this simple if ststement dose not run [CODE]>>> VList=[0,0,1,0,1,1,0,0] >>> if VList.count(1) < 5: print('Yes') else: print('No')[/CODE] The VList.count(1)works so not sure what is wrong, but I think that's were the code is crashing. Thanks | |
Guessing Game with functions, classes, methods, etc [CODE=python]#Code should always be in a method or class #Always start variable names with lowercase, classes could be capital #input.upper() allows the user to use lower or upper case for each option import random from operator import itemgetter def isint(x): try: int(x) return … | |
hello everyone ı just bougth a new walkman. ı am thınkıng of addıng or writing some media players ın to sony walkman. but ın sıde the walkman ıt has no any applıcatıon or programs do u have any ıdea how to add python programs ınt o walkman and also our … | |
Okay, so I'm sitting here bashing my head against the desk. I've been googling this for what seems the past hour. I cannot find any relative good links for making Python work with WAMP server. Yes, I understand how CGI scripts work. Unfortunately, I have no idea how to configure … | |
Whenever I run my python code, the window do not have any icon.. How to change it some icon or the icon I want to assign? I can assign a good icon for the exe generated thru py2exe. I want to assign icon for the window opened after double clicking … | |
[CODE]app = Tk() # creat a tkinter application window called "app" app.title("TVN Game Show") app.geometry("300x100+200+100") b1 = Button(app, text = "Correct!", width = 10, command = play_correct_sound) b1.pack(side = "left", padx = 10, pady = 10)[/CODE] In the above code, I understand that "app" is my TK() object. But what … | |
As I told before here is second implementation of one word anagrams, which prepares lookup table for all available words, if it is not generated and afterwards uses it for fast lookup. The implementation of lookup table generation is quite unoptimized, but it is only done once per vocabulary. If … | |
I made a program to search something on google and return how many results it has and it works perfectly as long as the sending code is not inside a function. If I put it in a function the reply from google isn't seen as a http packet(even though it … | |
I have my image converter up and running, except that I need to have multiple extensions for a single format(JPEG and TIFF). I tried putting the names in separated by commas, but that doesn't work. | |
I have been trying to use a wxPython textctrl to display a list of files, but it did not fit my purposes. The wx.StaticText seemed useful, and a ll works except for one major kink; I don't know how to scroll it. Moved post to its own thread, since the … | |
Hi I was wondering if there was any way in which using Python i would be able to move the mouse pointer and make it click at certain x and y values. This would be used in a Macro type machine for the mouse. I have looked around for modules … | |
Hi, I was wondering if anyone has a sample code on how to implement fuzzy c means clustering in python for 3D points. I looked around online and haven't found anything promising. Thanks. | |
hi. wondering if someone can take a few min to help me out. Well im taking this opencourseware from MIT, intro to programing. I got this assignment [url]http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-00-introduction-to-computer-science-and-programming-fall-2008/assignments/pset9.pdf[/url] and I could do it on my own... the only problem is I dont understand what the hell they want me to … | |
import MySQLdb db = MySQLdb.connect(host = "localhost",user = "root",passwd = " ",db = "TESTDB" ) cursor = db.cursor() sql = """CREATE TABLE CRAWLER ( FIRST_NAME CHAR(20) NOT NULL, LAST_NAME CHAR(20), AGE INT, SEX CHAR(1), INCOME FLOAT )""" cursor.execute(sql) db.close() when i execute this code there is an error occure like … | |
how to install the msqldb package and where to place it in python? then when i compile the code there is an error like no module named MySQLdb.... pls clarify this.... | |
Hello All! I ran across a bit of code that I wanted to try. In this code it had a line reading, "[COLOR="Red"]orig = POINT()[/COLOR]" When I tried to run I got this error: [COLOR="red"]NameError: name 'POINT' is not defined[/COLOR]. This led me to believe that I didn't have the … | |
Hi all, I have started a wiki that I hope to make the "unofficial Daniweb wiki". Its mission is to present short, compilable answers to many commonly asked questions here on the forum. [url]http://programmingexamples.net[/url] I have seeded it with a handful of c++ examples, but I'm hoping that some of … | |
hi , i have been searching for a way to modify .exe files using python, to make changes to the exe (inject user code), i found examples using other languages, but how can i do this using python? i know it is possible to alter the exe file because i … | |
Hello, I am trying to write a program in python to test the reading speed to a file, apparently,after the file is created, it's automatically in the cache and read() method will grab the data from the cache thus result in a much faster reading speed, how should i directly … | |
hi i need some help about zope. i worked with django before but now i want to start a medium project(dynamic website/webapplication) with some developing in future. now i'm not sure to switch to zope. i know zope support mvc like django, but django has some really magics. does zope … | |
| Hey all, I'm working on a program where I calculate powers of two upto 60. I've made my own formula for calculating it which is: 10^([value of log 2 here]*y), where 'y' is any power as big as, say, 31. So here it is: [code=python] two=0.301029995664 final=math.pow(10,(two*n))-1 [/code] Now... as … |
I cannot seem to get Reportlab's 4 state bar code to work. I keep getting "NameError: name 'USPS_4State' is not defined", yet if I 'dir' the module it's clearly loaded; dir(usps4s) arcode', 'USPS_4State', '__all__', '__builtins__', '__doc__', '__file__', '__ e__', '__package__', '__version__', '_crc11', '_initNof13Table', '_ru13', '_t The usage is correct as … | |
Can this be done in python and which module would i have to look at. I haven't experimented with this and if I have to guess would it be the os.renames() function. | |
Is there anyway, without using threading, to get python to do the following do for 5 seconds do action else do something else |
The End.