15,181 Topics

Member Avatar for
Member Avatar for mmpal78

Hi, I have python 2.7 & python 3 installed on ubuntu. I just installed pygame and have it working so far in python 3 which is what I want to be doing. However I can only load bmp images in python 3. When I try to load a jpg I …

Member Avatar for slate
0
517
Member Avatar for inuasha

alright so my exact problem is that when I attempt to visit a url stored in a text file I get the error "URLError: <urlopen error no host given>" This is strange because if I type in the urls myself they work fine(opener.open("site.com")) The lines of code causing the error …

Member Avatar for snippsat
0
275
Member Avatar for aVar++

I have my battleships game working completely accept ships do not generate randomly. I have each point of the ship assigned to certain squares. Example: ship_1_1 = Grid[1][1] ship_1_2 = Grid[1][2] ship_1_3 = Grid[1][3] ship_1_4 = Grid[1][3] Randomly generating ships is harder than I thought. For these reasons: - Ships …

Member Avatar for woooee
0
460
Member Avatar for vegaseat

A function to take a text and extract the string between two given substrings. Allows you to find the nth occurence. Also safeguards against dead ends.

2
1K
Member Avatar for JordanSimps

I kind of have an idea what to do, but I can't figure it out. The program needs to be able to get the students name and three test scores, then get the average score (percentage) out of the three scores. After that, you need to convert the score (percentage) …

Member Avatar for vegaseat
0
256
Member Avatar for rev_ollie

Hi again, I've been looking more at reading serial - this time with a GUI in front. After attempts to get it working I thought it best to try threading to perform the task. What it should do is read the serial port and update a label with the frame …

0
310
Member Avatar for bumsfeld
Member Avatar for Umar Suleman
3
405
Member Avatar for aashishkulkarni

I am going to create graphics interface to intermediate code generated by the gcc. so the output from gcc is like ;; Function main (main, funcdef_no=1, decl_uid=2162, cgraph_uid=1) main () { int i; int c[10]; int b; int a; int D.2177; <bb 2>: a = 1; b = 20; if …

0
151
Member Avatar for ZeeeeeV

I have been working on a Python coded priority email inbox, with the ultimate aim of using a machine learning algorithm to label (or classify) a selection of emails as either important or un-important. I will begin with some background information and then move into my question. I have so …

0
166
Member Avatar for m_ishwar

Hey this bit of code is giving a lot of trouble. I am new to python and have no idea why I am getting an error like this : Traceback (most recent call last): File "D:/Python27/saved/digital_filter.py", line 83, in <module> app=Application(root) File "D:/Python27/saved/digital_filter.py", line 23, in __init__ self.create_widgets() File "D:/Python27/saved/digital_filter.py", …

Member Avatar for m_ishwar
0
192
Member Avatar for TBSouth

Hi. I'm currently working on my bachelor's thesis in which i'm hoping to assess whether a (simplified) programming exam generates a "better" result if taken in an adjusted computerized environment compared to taking it with only the use of pencil and paper. I have built a web based platform, with …

Member Avatar for TBSouth
0
164
Member Avatar for padton

I have over 10 text files, each file has exactly 2671 floats e.g. 1.232124234 #line 1 2.324234323 #line 2 . . 1.324234234 # line 2671 I would like to the add together the floats on each line with the float on the corresponding line for each of the 10 files, …

Member Avatar for snippsat
0
221
Member Avatar for aVar++

Hi guys, I got this from my teacher and im really confused. could anyone point me in the right direction? Thanks > What does it do? > > This time I'm looking for an overall summary, in one sentence, with the word "by" in the middle: > "This function ..........., …

Member Avatar for Lucaci Andrew
0
228
Member Avatar for nivert

so i'm making a project for a buddy that's going to (eventually) ask a word, then it's definition, and I need 50 entry boxes on the screen, but there must be a simpler way to grid all of them (I'd like to use a sort of for loop instead of …

Member Avatar for Lardmeister
0
10K
Member Avatar for TrustyTony

Notice that if you negate a boolean value with `not` in comparison with other boolean value or similar, you should put it inside a pair of parenthesis, otherwise you get syntax error: >>> 0 == not 1 SyntaxError: invalid syntax >>> 0 == (not 1) True >>>

Member Avatar for ZZucker
2
185
Member Avatar for BigPaw

In [this thread](http://www.daniweb.com/community-center/geeks-lounge/threads/436142/which-language-is-best-suited) in the Geeks Lounge it was wisely recommended that I download an add-on for Python called Numpy. However, Numpy isn't presently available for Python 3.3. What should I do, please? How important is Numpy? Also, what would be the implications for not having wxpython available to Python …

Member Avatar for Lardmeister
0
694
Member Avatar for Rod53718

How do you get an imported function to find a function in the main program? This runs fine if I put the generate_random function in with the main, but if it is in an imported function it can't find the printa function in the main. It comes up with the …

Member Avatar for Rod53718
0
268
Member Avatar for nivedita.datta

Hi, I am unable to run the code given in the following link https://github.com/hamilton/LocalitySensitiveHashing properly. Can anyone help me on the instructions, as in where and how to provide the data. I am facing problem in the following step : this_lsh.bin_data(data) as given in the README. I am unable to …

Member Avatar for vegaseat
0
290
Member Avatar for slasel

I tried to create those 6 radiobuttons(bh1,bh2,bh3,bh4,bh5,bh6) using a for and placing them in a dictionary but I get the following error whenever they should be displayed! I have attached a folder with the images. Any help please is highly appreciated! Thank you Exception in Tkinter callback Traceback (most recent …

Member Avatar for vegaseat
-1
344
Member Avatar for petzoldt01

Just polling for users who are familiar with Django. Deployment? Development? Maintenance? Doesn't matter! Just trying to get a head count, maybe spawn some topics, make some friends, or whatever. Django is a pretty fantasitic project. It is extensive and documented extremely well (almost too well; reminds me of the …

Member Avatar for vegaseat
0
193
Member Avatar for ITech

inventory = {'gold' : 500, 'pouch' : ['flint', 'twine', 'gemstone'], 'backpack' : ['xylophone','dagger', 'bedroll','bread loaf']} how do i delete the item 'dagger' only from the 'backpack'

Member Avatar for Lucaci Andrew
0
71
Member Avatar for mccrimmonmd

My company recently hosted a programming competition for schools across the country. One team made it to the finals using the Python client, one of the four default clients provided (I wrote it). Most of the other teams were using Java or C#. Guess which team won? http://www.windward.net/codewar/2013_01/finals.html * *This …

Member Avatar for Lardmeister
1
127
Member Avatar for RockJake28

I have this code so far #Add two digits def add(a,b): return a+b #Subtract two digits def sub(a,b): return a-b #Multiply two digits def mul(a,b): return a*b #Divide two digits def div(a,b): return a/b #returns an integer that the user enters def getCommand(): cmd = input("Choose: ") return cmd #Execute …

Member Avatar for Lardmeister
1
217
Member Avatar for pxalpine

I have 2 text files: *cities.txt* San Francisco Los Angeles Seattle Dallas *master.txt* Atlanta is chill and laid-back. I love **Los Angeles**. Coming to **Dallas** was the right choice. New York is so busy! **San Francisco** is fun. Moving to Boston soon! Go to **Seattle** in the summer. *output.txt* <main><beg>I …

Member Avatar for pxalpine
0
143
Member Avatar for sudipta.mml

Hi ALL, I want to analyze my data by a python script. The data are in multiple file and they are kept in different directories. Moreover, the name of the files in those directories are same but have different extension. I want to get my output just by providing a …

Member Avatar for otengkwaku
0
225
Member Avatar for Octet

Hello Daniweb, I'm learning Python at the moment, and I'm starting by looking at automating some of my server tasks, namely things like backups, virus scans and checking for IP changes (being on a dynamic IP, automating this task will be very helpful). I've started by creating some code which …

Member Avatar for Octet
0
177
Member Avatar for Fernando_1

# Purpose: Tax input amount # #----------------------------------------------------------------------- # VARIABLE DEFINITIONS salesAmount= 0.0 salesTax=0.0 total=0.0 #----------------------------------------------------------------------- # CONSTANT DEFINITIONS #----------------------------------------------------------------------- # FUNCTION DEFINITIONS #----------------------------------------------------------------------- # PROGRAM'S MAIN LOGIC salesAmount = float (raw_input("Enter the sales amount:")) salesTax = float(salesAmount*0.08) total = salesAmount + salesTax print "The sales amount is $", salesAmount print …

Member Avatar for vegaseat
0
217
Member Avatar for vegaseat

You may want to call Python's list the answer to other computer languages' arrays. Here we take a look at the things you can do with lists, create an empty list, list the attributes and methods, load, append, count, insert, join, pop, remove, remove duplicate items, reverse, search, sort, establish …

Member Avatar for vegaseat
3
406
Member Avatar for biscayne

I have a table with product codes, the first two chars of the product code is the product group. using the product group I'd like to test the content of certain data. Would this be proper coding or is there a better way ? if prodcust_code[:2] == "AB" do: ABsubroutine …

Member Avatar for vegaseat
0
235
Member Avatar for clouds_n_things

Really quick question, if I want to return the data that is returned by snesVar in videoGame as a string on every line, what is the correct code to use? def videoGame(): count = 0 snesVar = [] for data in os.listdir('/SNES/SNES Roms'): if data.endswith('.src') or data.endswith('.srm'): snesVar.append(data) return snesVar …

Member Avatar for clouds_n_things
0
129

The End.