15,175 Topics
| |
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. … | |
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 … | |
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, … | |
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 … | |
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 … | |
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 … | |
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): … | |
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] | |
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. | |
[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) … | |
***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]) … | |
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 … | |
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 … | |
I want to get a list with just folders (without subfolders). Any idea how to do that ??? | |
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) - … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
i am having an error with this simple bluetooth console it has error that says: NameError: name 'sys' is not defined call') here is the code sorry i am a noob in python i am trying different samples for me to learn hope somebody will enlighten me: [code=python] import socket … | |
Hello all, I normally lurk around and solve most of my issues by reading other threads. I have run into an issue and I am trying to figure out what I am missing. I am rather new at this so thanks for any advice. What I am attempting to due … | |
i have a problem... i am new to python... and i have found a program that reads an sms directly from the phone's inbox... i am using nokia 6600... i just want to ask how will i be able to copy the sms file to a string? here is the … | |
Most people would do something like this: [icode]input("Press any key to continue") #or raw_input[/icode] This way, if the user presses a key other than the Enter (return) key, then the program will still continue. It looks something like this: [URL="http://i42.tinypic.com/2yvp9hj.png"]http://i42.tinypic.com/2yvp9hj.png[/URL] | |
US --9--15--13--37 GE --10 --13--7--30 CA-- 14 -- 7 -- 5-- 26 (those dashes are meant to be spaces) How do i remove the first column of the text above so the output would look something like this? 9--15 --13 --37 10 --13--7--30 14 --7-- 5--26 | |
Hello, I have a question pertaining to Python. I have been using the online book "How To Think Like A Computer Scientist" and have been doing the questions at the end of the chapters. I cannot figure out how to modify "num_digits" so that it works as expected.I have tried … | |
Hi folks, ThompsonSensibl, so I'm new to Python. This is probably a noob question... I want to convert a String input to an Integer. I usually do it like this: number = int(someString). However this time this approach doesn't seem to be efficient at all. So far I have: [CODE] … | |
Question regarding compiling *.py script. Everything works fine when I compile the script except that there is no "theme". It looks like it's using win 98 skin or something. Looks very bad. Would like to know how to preserve [COLOR="Green"][I]gtk-theme-name = MS-Windows" [/I][/COLOR]. Which packages or modules should I include … | |
Please can u read two list of numbers into an array and merge sort them in an ascending order into 1dimensional array | |
now i have a finished template which wrote by j2ee,like this: <#list dailyStarList as dailyS> <li <#if (dailyS_index % 2) == 0>class="list_color_w"<#else>class="list_color"</#if>><h2><#list chatAvatarList as cal> <#if dailyS.avatarid == cal.id> ${(cal.name[0..1])!''}之星 <#break> </#if> </#list></h2><h3><#if (dailyMemberList)??> <#list dailyMemberList as dm> <#if dailyS.idx == dm.idx> ${(dm.myname)!''} <#break> </#if> </#list> </#if></h3><h4>${(dailyS.dailyNum)?c!''}</h4></li> </#list> And Now … |
The End.