15,185 Topics

Member Avatar for
Member Avatar for ITgirl2010

Ive started with this program def calcFinal(): while True: try: asg1Mark = int(raw_input("Enter Asg1 mark: ")) asg2Mark = int(raw_input("Enter Asg2 mark: ")) examMark = int(raw_input("Enter Exam mark: ")) final = asg1Mark + asg2Mark + examMark return final except ValueError: print 'Please enter only numbers' def mark_check(finalMark): print "Final mark is …

Member Avatar for woooee
0
112
Member Avatar for Stev0

Several weeks ago, I wrote a simple web crawler that was designed to simply retrieve robots.txt from a range of IP addresses. It was entirely CLI based, and I had it working perfectly. As my python experience has increased, I decided to start learning about GUI based programming, and decided …

Member Avatar for Stev0
0
162
Member Avatar for Hoban

First off this is for a homework assignment and I am new to python. I have attempted to tweak an example of how to make a table from another post on this forum but with no luck. Here are my problems: 1) my range is small (0, 1, 0.1) This …

Member Avatar for vegaseat
0
113
Member Avatar for goodwin912

I've got a little app to resize and watermark images. At the moment it only does one at a time but I would like to get it to do a full folder of images in one go. I have done this previously in VB using loops but im new to …

Member Avatar for Tech B
0
229
Member Avatar for ktsangop

Hi everybody. Could someone explain me the usage of python's modulo operator and/or the fmod function? why do i get these results? >>> 23%0.1 0.099999999999998729 >>> import math >>> math.fmod(23,0.1) 0.099999999999998729 >>> normally 23 mod 0.1 = 0 because 23 / 0.1 = 230 exactly is there anything wrong there …

Member Avatar for ktsangop
0
242
Member Avatar for kjock002

the random function gives you a number between 0.0 and 1.0 . im trying to get a random number between -0.5 and 0.5. i asked someone for help and they told me to go off of this: [0, 1) + .1 this changes the range to [1, 2) and i …

Member Avatar for Gribouillis
0
98
Member Avatar for leviaeon

i am really wondering why this type of error continues to occur for every bluetooth code i try.. i am trying to connect to a bluetooth module... i am wondering why i cant connect to that module where in i can connect to other devices like mobile phone and laptops... …

0
58
Member Avatar for leviaeon

i have an error with this sample code i got from the net... the error says: TypeError: unsupported operand types for +: 'int' and 'str' here is the code: from time import ctime [COLOR="Red"]import[/COLOR] codecs [COLOR="red"]import[/COLOR] inbox, appuifw box = inbox.Inbox() msg = box.sms_messages() f = [COLOR="red"]codecs.[/COLOR][COLOR="Green"]open[/COLOR]('E:/Others/listSMS.txt', 'w', 'utf8') # …

Member Avatar for leviaeon
0
90
Member Avatar for LostGurl

Hello.. Im doing some simple text processing using Python which include indexing, splitting and tokenizing text from folder. i want to improve the stemming and tagging process using MontyLingua by importing the Monty library for tokenizing and tagging. I dont know how to edit and call them in my coding. …

Member Avatar for PassBy
0
483
Member Avatar for kjock002

the program below simulates a game of craps and its pretty much done except for a way to get the while loop to stop. i was trying to get an input from the user when they wanted to stop rolling and to enter "n" for no but im not sure …

Member Avatar for jcao219
0
115
Member Avatar for kjock002

so im trying to simulate a walk where the user will randomly take either a step forward or backwards, hence using the probability of a coin flip. i think the program is pretty much self explanatory. i just need help debugging it because it doesn't seem to work properly yet. …

Member Avatar for jcao219
0
179
Member Avatar for girlscodetoo

Hi Guys! I am a Python noob. I wanted to merge data and eliminate duplicates. I have the solution. Now I am stuck at dumping the dict contents to MySQL. Any help is really appreciated. Data : [QUOTE]a b c d e f key dupe -------------------- 1 d c f …

Member Avatar for girlscodetoo
0
182
Member Avatar for JJBallanger

Hi there, As a student I am new to python and am struggling with the following program I have been tasked to create. My code so far is like so. The idea is that the function will take a guess x, incorporate an arbitrary function f(x) and then take feps, …

Member Avatar for JJBallanger
0
229
Member Avatar for alabay2010

Hello everyone! I have task to write a program that would read a data from any txt file and visualize it on a bar chart using turtle module. I have to structure the program using modules and functions for nice design. The program must be fit for any other txt …

Member Avatar for TrustyTony
0
621
Member Avatar for zoro007

Hello, I want know how to find some of words in a file. For example : find one word [CODE]if "word" in open(file).read(): print file[/CODE] I wand do that but with 5 words [ word1 , word2 , word3 , word4 , word5 ] If find word1 or word2 or …

Member Avatar for sebcbien
0
161
Member Avatar for belboy

Country Gold Silver Bronze Total US 9 15 13 37 GE 10 13 7 30 CA 14 7 5 26 NO 9 8 6 23 AU 4 6 6 16 RF 3 5 7 15 KO 6 6 2 14 CH 5 2 4 11 SW 5 2 4 11 …

Member Avatar for TrustyTony
0
112
Member Avatar for kjock002

i found this code [URL="http://www.daniweb.com/forums/thread233959.html"]here[/URL] and i tested the code and it isn't working for me this is what my code looks like: [CODE] # PURPOSE: to count the number of words, lines, and characters in a file # # INPUT(S): a file name to be used # # OUTPUT(S): …

Member Avatar for TrustyTony
0
2K
Member Avatar for ihatehippies

Anyone know of a way to tell the difference between an inherited class method and a individually defined one? ie: [CODE=python]class test(str): def unique(self): pass x = test() # how to test for difference between x.unique # and x.lower[/CODE]

Member Avatar for ihatehippies
0
73
Member Avatar for pareshverma91

can any one please give me a link from where i can find out how python executes internally,i mean the way objects are declared, stuff stored etc.

Member Avatar for scru
0
106
Member Avatar for peppermints

[CODE]from Tkinter import * import random weapons = ("rock", "paper", "scissors") class Application(Frame): def __init__(self, master): Frame.__init__(self, master) self.grid() self.create_widgets() def create_widgets(self): Label(self, text = "Choose your weapon!\n" ).grid(row = 0, column = 0, sticky = W) Label(self, text = "Weapons:" ).grid(row = 1, column = 0, sticky = W) …

Member Avatar for jcao219
0
714
Member Avatar for Enders_Game

***Editted: added second problem I have this code, how do I make it stop once it's found the first instance of the [B]if[/B] happening. break, myparser.close(), and return don't work. [CODE]from html.parser import HTMLParser class MyHTMLParser(HTMLParser): def handle_starttag(self, tag, attrs): if tag == 'a' and (attrs[0][1].find('downloads&showfile') != -1): print(attrs[0][1]) print(attrs[1][1]) …

Member Avatar for Enders_Game
0
169
Member Avatar for Diomedes

Hello Python forums, I started working with Python recently and picked up a book. The book stated discussing using the ctypes module in python which is slick because it's exactly what I need to be learning. I started trying to test my knowledge by implementing a simple, singly linked list …

Member Avatar for TrustyTony
0
689
Member Avatar for biomed

I have files that contain lists of lists. Each file has about 20.000 lists that each list member is a list of itself with 15 values. Think of it as a database table. I know we can use a binary search to find a member of a list but can …

Member Avatar for sneekula
0
137
Member Avatar for Sauronevileye

I want to get a list with just folders (without subfolders). Any idea how to do that ???

Member Avatar for Sauronevileye
0
157
Member Avatar for the_mia_team

I will donate $10 via paypal whoever can help me with this code. heres my assignment [QUOTE]Write a Python class named "Car" that has the following data attributes (please create your own variable names for these attributes): - Year_Model (for the car's model) - Make (for the car's maker) - …

Member Avatar for Mensa180
0
4K
Member Avatar for helios0684

Hey guys, first time poster, relatively long time reader -- I am struggling creating a buffer class in python for my class. (relatively new to the language). Here is the basic idea I want to do: Implement a class that buffers text. The write() method adds a string to the …

Member Avatar for helios0684
0
2K
Member Avatar for PhrackSipsin

Hello All, I'm pretty new to python but have been programming, for a few years hobby wise and decided to try python after I found how concise the syntax was and with a computer science bent. So I'm writing a little code for a work related thing, simulating some basic …

Member Avatar for woooee
0
167
Member Avatar for wtzolt

Hi, I've made a small program which has 2 buttons and each does certain thing. Here's a simplified version of the code. Thing is it works fine except that the button freezes and stays in a clicked position and whole GUI freezes until the command is completed. As far as …

Member Avatar for jcao219
0
141
Member Avatar for ultimatebuster

Is it possible to limit a certain variable to only certain type? For example, i have a class named AccurateStr. How can I make sure that the variable "as" is an instance of AccurateStr? Similarly, how can I make sure a variable is a positive int, str etc without the …

Member Avatar for ultimatebuster
0
563
Member Avatar for vineshn

hi, I am new to python :). I am having a file say "test.c" test.c file contains test1 test2 test3 test4 and my output should be write in a file as newtest.c... -h test1 -e temp -x temp2 -o temp3 -h test2 -e temp -x temp2 -o temp3 -h test3 …

Member Avatar for vineshn
-1
133

The End.