15,190 Topics
![]() | |
Why are there so many people doing c++. I've heard even from c++ coders, that python is better. Is this maybe because c++ has been around longer? What do you think the future of python is? Do you think It will eventually beat out c++? | |
Hi, I am new at Python..i have been asked to create a code for the following item. A user needs to input the 'room number' and 'date' to equal a answer. Room Number: R1, R2, R3, R4, R5 R1 = Dates: 1/01/2000, 01/02/2000, 01/03/2000 R2 = Dates: 01/01/2000, 01/03/2000 R3 … | |
[CODE]import pygame pygame.init() def main(): screen = pygame.display.set_mode((640, 480)) pygame.display.set_caption('game') background = pygame.Surface(screen.get_size()) background = background.convert() background.fill(pygame.color.Color('yellow')) box = pygame.Surface((100,100)) box = box.convert() box.fill(pygame.color.Color('red')) t = True clock = pygame.time.Clock() while t: for event in pygame.event.get(): if event.type == pygame.QUIT: t = False elif event.type == pygame.MOUSEBUTTONDOWN: posi = pygame.mouse.get_pos() … | |
here's what i currently got [code]# Reading the .csv file energyFile = open("EnergySources.csv","r") stateDict = {} for line in energyFile: line = line.strip() fields = line.split(",") if fields[0] == "State" or fields[0] == "": continue state = fields[0] total = fields[-1] float(''.join(total)) coal = fields[1] float(''.join(coal)) naturalgas = fields[2] float(''.join(naturalgas)) … | |
Dear all, may be someone can help me to find a solution to the following problem: I have a list of patterns (len=5) that are presented as tuples in a list, e.g. patterns = [('w1','X1','w1','Y1','w1'), ('w2','w2','X2','w2','Y2'), ('w2','X2','w2','Y2','w2')] I want to go through all sentences in a text file (one sentence … | |
At the easy risk of asking something already asked a hundred times... Curses doesn't work for me. I use 2.6 on a Vista It gives an error saying it can't call up a part of the module that came with the program. ... Uhm... help.. T_T ~Pixel | |
If anyone is interested in helping with creating a mesh exporter I could really use the help. Willing to pay royalties that the exporter will receive when released for purchase. Please email for more information. seth at vandigital dot com Thanks, Seth Richardson | |
hi, i have an assignment due after 4 hours i'm willng to pay money for solving the assignment here is the assignment link SNIP row data: SNIP i'm serious about paying money and here's my email: SNIP | |
hi, i'm new in python programming i'm trying to write a simple program that processes a text file containing grades for a class, extracts the desired grades, count the number of grades in each grade segment and genrate a pie chart for grades,(A1) . [url]http://pages.cpsc.ucalgary.ca/~zongpeng/CPSC231/assignments/A3/a3.pdf[/url] any help would be appreciated … | |
Hello, I've read the python doc (C-API) and was wondering about the two reasons to extend python with C. The first reason is to implement new build-in object types and the second one is to call C-Library functions and system calls. Ok, I think i got the second one but … | |
![]() | Hey All, I have some code here, the problem is in line 82-83: [code='python'] import smtplib import wx window=wx.App() class pymailer(wx.Frame): def __init__(self): wx.Frame.__init__(self,None,-1,"Py-mailer",size=(500,700)) try: self.s=smtplib.SMTP("smtp.gmail.com",587) self.s.starttls() except: wx.MessageBox("Error 001: Could not connect to the internet, please try again later.","Internet Connection Error") self.panel=wx.Panel(self,-1) menubar=wx.MenuBar() filem=wx.Menu() filem.Append(201,"Quit") self.Bind(wx.EVT_MENU,self.Quit,id=201) viewm=wx.Menu() viewm.Append(202,"About") self.Bind(wx.EVT_MENU,self.About,id=202) … |
Hei..i am novice to programming. How to generate beautiful html pages from a text file. My idea is to generate XML first and then generate it to html. Generated html page should contain all the information that the text file contains..like tables,pics,body,headings. I dont have a clue what to do … | |
I want make a program that calculates the cartesian products of two sets. e.g.: This is how i would like the result to look like: >>> Enter two sets to calculate the cartesian product: set([7,9]), set([1,5]) set([(7,1),(9,1),(7,5),(9,5)]) [CODE]def main(): userinput = input('Enter two sets to calculate the cartesian product: ') … | |
I recently posted a very small program the uses pygame and the livewires package but was unable to get the program to run. I think the Title for that posting was Graphics Window or something close to that anyway. Since I can't resolve that problem, does anyone have any suggestions … | |
I have installed pygame and livewires but am getting the following error with the following short program that I got from my python book. [COLOR="Red"]AttributeError: 'module' object has no attribute 'init'[/COLOR] [CODE]# New Graphics Window # Demonstrates creating a graphics window from livewires import games games.init(screen_width = 640, screen_height = … | |
hi, i'm new in python programming i'm trying to write a simple program that processes a text file containing grades for a class, extracts the desired grades, count the number of grades in each grade segment and genrate a pie chart for grades,(A1) and here is the text file link … | |
My issue is essentially spelled out in the title. I want to be able to catch clicks (more specifically double clicks) on icons on the desktop or in folders or wherever, and tell where the click was on the icon (the coordinates of the click along with the whole size … | |
I wouldl like to query a date of when a photo was taken.. how may I do that? | |
This is my program: [CODE]def main(): print('This is a program to calculate the setprod') print() userinput = input('Enter two sets separated by a comma: ') value1, value2 = userinput.split(',') mylist1 = eval(value1.strip()) mylist2 = eval(value2.strip()) print(mylist1 + mylist2) main()[/CODE] If I enter following: [CODE]>>> This is a program to calculate … | |
![]() | So, I created this fun little Tic Tac Toe game all on my own. It was a tough project, and I know I used some inefficient strategies in the coding. Just like the other things I've posted, this could use a lot of suggestions in the areas of clean code … |
Sorry if this is a really easy question, but I've been going through control flows in the python documentation and something confuses me that it doesn't address. [CODE] a = ['Mary', 'had', 'a', 'little', 'lamb'] for i in range(len(a)): print i, a[i] [/CODE] When I type that in, it prints … | |
Ok, lets say I have a string [CODE] str = "main,sub,sub_sub" [/CODE] how could I use that to edit the value inside the dict [CODE] dicx = {'main':{'sub':{'sub_sub':'value to change'}}} [/CODE] ![]() | |
Having worked with txt files, I'm learning about binary now. My code below works for a while then bombs out, can you point me towards a method or module to read binary data line by line? The crypto module requires a buffer (don't know how to create one of those) … | |
I am still rather new to the Linux OS and need some detailed advice on the installation of Python3.1 on my Ubuntu machine. Python3.1 is not in the Ubuntu package repository yet. | |
[CODE] def doKey(e): print(e.widget.get("1.0","end")) root= Tk() root.title('yada') txta = Text(root, width=40, height=10) txta.bind("<Key>", doKey) txta.pack(side=LEFT) root.mainloop() [/CODE] Pressing a key in this text area will always output the string prior to your pressing the key. Am I missing something? | |
I am a complete newbie to python but know some c++ Was wondering where i can get my hands on a 3D script for schooling(like fish) BattlingMaxo | |
![]() | hi all, I am designing a text editor program in Python using Tkinter and I was wondering if there's any way to get the current line number when the mouse is clicked somewhere on the text field, i.e the mouse position should determine the current line, like in the python … ![]() |
Write a function called NumDistinctDict that takes a single parameter alist that determines the number of distinct values in alist. For example, the list [1,2,4,2,7] contains 3 unique values (namely 1,2,4 and 7). | |
So I want to make a class based RPG, as a project to help me understand how classes work. Unfortunately, I didn't get far. The below code is intended to make an instance of a character and have info in it like name, health, gold, exp, and the like. I … | |
How do you know when to use a function by wraping the content between parentheses "function(x) or through dot notation x.function() ? thanks. ![]() |
The End.