15,194 Topics
![]() | |
I have recently redid an earlier version of my version of Pong. However, I am having a slight issue with it. Whenever the ball hits the opposing paddle and then hits the bottom, the ball travels along the bottom until the player paddle hits it. I have tried for days … | |
I am searching about programming languages to choose for improving myself in one of them in the way of my aims. Thus, I want to learn what is special for python and what is the general purpose of using this language, it is suitable for what kind of programs. Please … | |
I have to add inputs just in case i have up to nine lines that i need to add feet values too. but im curious if i only have 5 lines to input is there a way to bypass the other inputs cause if i in put zero it has … | |
New to python and I'm trying to save and import my first modules. When I go to import my first module which I've named convert.py I receive the following error: Traceback (most recent call last): File "<pyshell#0>", line 1, in <module> import convert File "C:\Python27\convert.py", line 1 Python 2.7 (r27:82525, … | |
[CODE]board = [['.', '.', '.'], ['.', '.', '.'], ['.', '.', '.']] pieces = ['X', 'O'] movetype = [0, 1, 2] turn = 0 breakgame = 0 def movecheck(): if x in movetype: if y in movetype: if board[x][y] in pieces: print 'Invalid move!' else: board[x][y] = pieces[turn] turncheck() else: print … | |
Hello everyone, I have created a text generator that acts on certain factors. I want to send every generated sentence via e-mail to a user but I noticed that everytime I send it, I encounter some problems. Below I show my code and under my code, I will describe the … | |
Two litle functions to help on text slice and spliting. The code comments say it all. [CODE]# Slicer takes as arguments a tuple containing the string before, # the string after and the string to truncate. It returns the string # between the two given strings Slicer = lambda((b, a, … | |
Hi All, I am really new to the programming world and I am trying to solve a simple problem for my python course- I have to write a script that retrieves Columbia University's webpage and prints only the titles of the news stories on the main page. I have to … | |
hi, Plz can u help me find a appropriate python code for identifying various musical instruments from a given sound file | |
hi, i'm having trouble taking say the input of the user and converting it to the right type of format i need in order to compare them. An example is say I have the number 1234 and that is assigned to the variable x and the string value of that … | |
Hey guys, Trying to learn python. Anyone have any idea why this prints score_value first? ie this is the output {'score_value': 3.0, 'score_type': 1}{'score_value': 3.0, 'score_type': 4}{'score_value': 3.0, 'score_type': 5} [CODE] scores_for_bulk = [] for i in range(4): if not score[i] == 0: self.response.out.write({"score_type":SCORE_TYPES[types[i]], "score_value": score[i]}) [/CODE] Any help would … | |
![]() | Dear All! I want to introduce a useful tool for ORMs, called Entity Extractor. It was originally wrote to use with Storm, but then it extended in a way that can be use for any kind of code generation from any kind of data-source. The main idea behind this tool … |
Compress and decompress files using the popular pkzip format and the Python module 'zipfile'. [B][COLOR="Red"]Concept Error! This code just does archiving into a zip file, no compression![/COLOR][/B] To compress and archive files it is best to use module tarfile, see the snippet at: [url]http://www.daniweb.com/code/snippet216860.html[/url] | |
[CODE]from PIL import Image, ImageDraw from random import randint picture = Image.new("RGB", (600, 600)) artist = ImageDraw.Draw(picture) for i in range(100): x1, y1 = randint(0, 600), randint(0, 600) x2, y2 = randint(0,600), randint(0,600) color = (randint(0, 255), randint(0, 255), randint(0, 255)) width = randint(2, 20) artist.line([x1, y1, x2, y2], color, … | |
I want to create a list which will list coordinates on a 50 by 50 grid. I have been able to set the x-value from 0 to 49, while maintaining the y-value as 0. When I try to reset the x-value back to 0, and increment the y-value by 1- … | |
I want to create a list which will list coordinates on a 50 by 50 grid. I have been able to set the x-value from 0 to 49, while maintaining the y-value as 0. When I try to reset the x-value back to 0, and increment the y-value by 1- … | |
hello im new with python and i want to you ask a question. is there any function like switch on C++ ? | |
Hey, i want to make a push to talk a chat, but i dont know how. [CODE]import pyaudio import sys chunk = 1024 FORMAT = pyaudio.paInt16 CHANNELS = 1 RATE = 44100 RECORD_SECONDS = 5 p = pyaudio.PyAudio() stream = p.open(format = FORMAT, channels = CHANNELS, rate = RATE, input … | |
Hello! How can I format a text control to show only the date in YYYY/MM/DD format using slashes? Furthermore, I would like to display a calendar icon beside it which opens an expandable calendar and sends the selected date to the text control field. This way, the user can enter … | |
[CODE]class FooBar: def __init__(self, value = 42): self.somevar = value[/CODE] f = FooBar('This is a constructor argument') f.somevar This is a constructor argument How can the parameter value know what kind of data it's going to be given? Int, float, string, etc? thanks. | |
Hello everyone, I'm working on a random text generator -without using Markov chains- and currently it works without too many problems -actually generates a good amount of random sentences by my criteria but I want to make it even more accurate to prevent as many sentence repeats as possible-. Firstly, … | |
Hello everyone, I'm working on a random text generator -without using Markov chains- and currently it works without too many problems. Firstly, here is my code flow: 1-Enter a sentence as input -this is called trigger string, is assigned to a variable- 2-Get longest word in trigger string 3-Search all … | |
I'm brand new to coding and python. Could someone tell me what is wrong with my code? [CODE] def getlist(): lst=[] answer1 = raw_input ("Would you like to add a number to create your mean value? y/n") if (answer1 == "y"): x = input ("Your number:") lst = lst + … | |
Few days ago I finished making my own (quite primitive) chat server with SocketServer. I haven't had any problems with it apart from the designing of the chat protocol: I made a very sketchy protocol for messaging. The client just sent unix-like commands to the server to do certain opperations: … | |
Hi, I am trying to generate a list of random numbers where each number in the list is a individual string. This is my code so far: [CODE]import random def make_secret(numdigits): a=[] secret = random.sample(range(0, 10), numdigits) for i in secret: a.append(str(secret)) return a[/CODE] An example of what i'm trying … | |
Okay i'm really sorry to have basically bombarded this forum but this is my last cry for help on this project I swear! I guess many of you are intimately familiar with what's happening so far, and thank you all so much for putting up with me =) I've got … | |
Yet another thread showing how awful I am at programming... I've got a list called week_pattern It contains a list of 52-character strings which represent whether something occurs in a certain week. The list is below: [CODE]['0000000000111111111100000000000000000000000000000000', '0000000001000000000000000000000000000000000000000000', '0000000000000000000000000011111111000011100000000000', '0000000000000101111100000000000000000000000000000000', '0000000001111111111100000000000000000000000000000000', '0000000000111111111100000000000000000000000000000000', '0000000000000000000000000001111111000001100000000000', '0000000000111000000000000000000000000000000000000000', '0000000001111111111100000000000000000000000000000000', '0000000000000000000000000011111111000011100000000000', '0000000000000000000000000011111111000011100000000000', '0000000000000111111100000000000000000000000000000000', '0000000000000000000000000000000000000000001000000000', '0000000000000000000000000001111111000001100000000000', … | |
Hello, I'm trying to install a python based program, the instructions call for this command. I have python 2.7 installed & have successfully installed virtualenv using easy_install CODE_DIR=`pwd`/program PYTHON_BIN=/opt/python-2.5/bin/python VIRTUALENV_BIN=`dirname $PYTHON_BIN`/virtualenv $VIRTUALENV_BIN $CODE_DIR cd $CODE_DIR source bin/activate I try to run just the first line and I get this: Traceback … | |
this error keeps plaguing me with the code: [code=python] option = input('What would you like to do? ') if option == 1: newExpence = addExpence(totalBudget) totalBudget = totalBudget - newExpence elif option == 2: removedExpence = removeExpence(totalBudget) totalBudget = totalBudget + removedExpence elif option == 3: newRevenue = getNewRevenue() totalBudget … | |
hi, i am trying to implement a proxy based on BaseHTTPServer built-in module. the GET & POST methods work fine, but i have some problems implementing the CONNECT (do_CONNECT) method, i understand how ssl tunneling works theoritically, i tried to implement it using httplib.HTTPSConnection, i write the headers and the … | |
Hi dears. I want to send a string as sms in gsm modem witch mixed from english and unicode word. for example: "hello in persian is 'سلام' in arabic is 'السلام'." now, how I can make a pdu format from this string and what change I have to make in … | |
Hello! I am trying to edit a csv file. This is my original csv file [CODE]"TINAMIFORMES",,,, ,"Tinamidae",,, ,,"Tinamus",, ,,,"tao","Grey Tinamou" ,,,"solitarius","Solitary Tinamou" ,,,"osgoodi","Black Tinamou" ,,,"major","Great Tinamou" ,,,"guttatus","White-throated Tinamou" ,,"Nothocercus",, ,,,"bonapartei","Highland Tinamou" ,,,"julius","Tawny-breasted Tinamou" ,,,"nigrocapillus","Hooded Tinamou" ,,"Crypturellus",, ,,,"berlepschi","Berlepsch's Tinamou" ,,,"cinereus","Cinereous Tinamou" ,,,"soui","Little Tinamou" ,,,"ptaritepui","Tepui Tinamou" ,,,"obsoletus","Brown Tinamou" ,,,"undulatus","Undulated Tinamou" ,,,"transfasciatus","Pale-browed Tinamou" … | |
Hi Folks, Windows/Python3.1.2 I'm totally at a loss with this one... The code is supposed to open a file (postscript with UNIX LF-only EOL characters), look for and change a line, then write the lines back. It works fine, except for the fact that I can't dissuade Python from writing … | |
We have implemented ConfigParser object to parse the log file and load tested the application, but it was failed after 50 records created due to memory error. we removed ConfigParser's code and re-tested then the transaction was completed successfully, finally we figured out that this object is creating more objects … | |
This one might be a challenge... Okay some of you might have an inkling what i'm trying to do already from the last thread (thanks for helping!) but I figured I should start a new topic for a new problem so that people can search solutions easier. I've got multiple … | |
Hello, What's the right way to open and close dialog windows multiple times? At the moment I instantiate a dialog window on a clicked button signal, then close it with self.close() but when I open it again Python crashes. So I can open the dialog only once. How can I … | |
Hello everyone, I am trying to process various texts by regex and NLTK of python -which is at [url]http://www.nltk.org/book-[/url]. I am trying to create a random text generator and I am having a slight problem. Firstly, here is my code flow: Step-1)Enter a sentence as input -this is called trigger … | |
What are some alternatives to writing [CODE]len(mylist3 & mylist4)[/CODE] within this code? [CODE] mylist1 = [1,2,3] mylist2 = [4,5,6] mylist3 = set(mylist1) mylist4 = set(mylist2) lenresult = len(mylist3 & mylist4) [/CODE] A module i'm importing is unable to use the count() that gets called with the ' & ' operator. | |
Hey all, I've been having some problem with python - i'm pretty awful at programming but have been soldiering on with this for some time now! What I need to do is take one list and compare it to another. Both lists are presented in rows, and I need to … | |
Why do people say isinstance is bad? If I have my own class, named Test, and if I want to check an variable to see if it is an instance of Test or Test's child classes, is using instance() bad? | |
Hi, im looking for any tips on how to make a program that can move the windows vista mouse icon to different spots + left and right click. So I can tell it to go to this spot and click. can anyone please help | |
![]() | Hello all, I want to make a Python program which will go to a particular site, login with my credentials, and do a specific task, such as in this case: go to WordPress.com, login, navigate to the drafts section, and add a line to a draft. I believe most of … |
Hi everyone, I'm making some kind of game in Python and i need to save random number to text file but i cant. Please help me out. Here is the code: [code]def lvl(): x = random.randint(100,1000) tfile = open("text.txt", 'w') tfile.write(x) input("")[/code] Without x everything is good, but i need … | |
Hello! As a part of a database project, I need to find a way to send a MySQL table to wxpython and then select some of its records (using a Select/Remove button) to store them in another class of the database. Is there any kind of widget to do this? … | |
Hi, I have a content type with a selection field whose value I would like to set programmatically (ie, for all items in a folder). I know this is a vague question but can anyone point me towards something that might help me figure this out? Thanks in advance! Cheers, … | |
Hello! I am trying to update a MySQL table using a Python code but I am having some problems. I define the connection and the cursor in the Ornithobase (wx.Frame)class in the OnLof function as [CODE]self.db= MySQLdb.connect(host='localhost', user=self.Username , passwd=self.pwd, db='Ornithobase') self.cursor = self.db.cursor()[/CODE] Then, in the same class but … | |
Hello all, To begin, I am working with a MySQL database using python. In the database, I am working with 3 columns: REF_ENTRY_TIME, REF_EXIT_TIME, REF_ENTRY_VALUE. My goal is to graph the net value position against time. For the time portion, both REF_ENTRY_TIME and REF_EXIT_TIME are random various times between 9:00 … | |
Hi, all! I was wondering if there is any way to check from the server side whether the client has closed a socket connected to one on my side. client side [CODE]import socket s = socket.create_connection ((host, random_port)) s.close () [/CODE] server side [CODE] ... a = lstn.accept () [/CODE] … | |
When you think of Media player, you need beautiful look n feel. I know GIMP can do alot. But Skin in wxPthon? I don't think it is possible. So I thought and thought then I came with this Idea. Create panel with Image as background and then Load wxBitmaps and … | |
helo guys good day... i have a problem in python programming... im new to this langauage.. im having a bit problem on creating a program in python that would determine if the integer is divisible by 3 or not without using a modulus? im glad if you can help me … |
The End.