15,175 Topics
| |
I have been working with lists for a year now, but I am inconsistent with the way I have them setup. I want to know the standard. Let's say you have a computer represented as pixel colors in the form of a list. To simplify it let's just use numbers … | |
Can anyone give me these solution PLZ.[TEX][/TEX] [CODE]import string STUDENT_ID = 0 STUDENT_FIRST_NAME = 1 STUDENT_SECOND_NAME = 2 STUDENT_MARK = 3 def inputMarks (mList): print "inputMarks not yet implemented" def calcGrade (mark): print "calcGrade not yet implemented" def printIndividualRecord (record): print "printIndividualRecord not yet implemented" def printAllRecords (mList): print "printAllRecords … | |
please could some one understand what i am saying i need a program that can count number of digit in a number given by the user .for example if we see123 it has 3 digits...? | |
Hello Quick question: Does anyone know why my window doesn't show frame? Thank Mark [CODE] import sys from PySide import QtCore, QtGui class UI_CMDTester: def __init__(self): self.__app = None self.__win = None def init(self, \ w_title, \ w_width, \ w_height): self.__app = QtGui.QApplication(sys.argv) self.__create_win(w_title, w_width, w_height) sys.exit(self.__app.exec_()) def __create_win(self, w_title, … | |
Need help building a phonebook that will store and produce a telephone directory. The phonebook needs to be able to order the data by first name, last name or birthday, and produce output as such. The data is to be stored in a text file (simple database), and can be … | |
Hi guys , I have the following code : [CODE]x=int(input())[/CODE] If I get a string from the user string ,list or a double , then I'd an exception . Is there a way to get any input from any type , and store it within "x" , even though I … | |
Alright, I am working on this for an assignment and I cannot seem to figure out where I went wrong... My first problem, whenever I input the CC number, the only one it accepts is the last one in my text file... My second problem, when it does accept a … | |
Hi All, i have basic python knowledge please let me know how to get started with jython please let me know where can i find good online books for jython, how to write some small programs and how to run them | |
hi all, i have been working for two months on a project and i have come up with an algorithm that is a mix of R. Mitkov's algorithm on anaphora resolution (robust, knowledge-poor algorithm) and several filters that are applied first to the xml file (a POS tagged text) to … | |
You can use a decorator to modify the function object once, by assigning initial values to some new attributes. Then use these attributes as you would use static variables in other languages. Here is the result: (1, 1, [1]) (3, 2, [1, 2]) (6, 6, [1, 2, 3]) (10, 24, … | |
Hello, I am vegaseat, the goofy moderator from the Python forum of DaniWeb. I wanted to know if anyone in the Java forum has played around with Java based Python, also known as Jython. Jython uses easy to learn Python syntax and can use the Java libraries. To make a … | |
In the book "How to Think Like A Computer Scientist" on the website openbookproject.net the tutorial leads you to draw a house with a pre-written script. It then instructs you to: # Wrap the house code in a function named draw_house(). # Run the script now. Do you see a … | |
According to the Python 2.7 manual this construction of the with statement should work: [code]text = "aim low and reach it" fname = "test7.txt" with open(fname, 'w') as foutp, open(fname, 'r') as finp: # write text to file foutp.write(text) # read text from file mytext = finp.read() print("to file --> … | |
Hello, I am currently trying to learn programming and am using Python to start with. I am currently practicing programming with classes and have placed the following code into a python file called complex.py: [CODE]class Complex def __init__(self, realpart, imagpart): self.r = realpart self.i = imagpart[/CODE] and placed the following … | |
I have 2 images, one is supposed to be on top of the other. This works fine until one of the "movement" keys are hit (a,s,d,w) [CODE]import sqlite3 as sqlite import wx username=None class MainWindow(): def drawmap(self): self.map4_31="C:/python27/game/4_31.gif" self.map1=wx.Image(self.map4_31,wx.BITMAP_TYPE_GIF).ConvertToBitmap() height=self.map1.GetHeight() width=self.map1.GetWidth() self.map1.map4_31 = wx.StaticBitmap(frame, -1, self.map1, (270, 170), (width,height)) def … | |
Basically, it is an open source software creation application that revolves around databases (similar to Microsoft Visual studio in some aspects but with python as the language). The user will be able to create forms with a drag and drop GUI builder, create an SQLite database and add functionality to … | |
So, I'm trying to assign some SQL to a variable which will later be executed in the code. I also want to include a varible inside the SQL. I am only allowed to code over 80 characters and then I have been told to use a black slash, now this … | |
[code] def main(): decimal=int(input('pleas enter a binary sequence: ')) number=binaryConvert(decimal) print("Contert to decimal: ", number) def binaryConvert(decimal): if decimal == 0 : return '0' elif decimal==1: return '1' number='' while decimal == '1' and decimal == '0' : number=str(decimal%2)+ number number=number main() [/code] but i did work well with me … | |
Anyone ever used the PIL (Python Image Library)? If you have, is there anyway to convert a single pixel at a time in a bmp file? I'm trying to invert a black and white image to white and black. So: [code=python] import PIL image = Image open(filename) pixels = list(image.getdata()) … | |
(question3.py) Write a word jumble game. In a word jumble the letters in a proper word are randomly mixed up and the user has to guess what the word is. The list of words to be jumbled can be found on D2L - jumble.txt. Here is one possible way to … | |
Hello everyone, I managed to recieve the contents of my email from gmail using the poplib module. But I am nor able to save these emails. How can I save the contents of email including images etc in most preferably in a html file?? Regards BattleX | |
Hi, I'm trying to convert a textfile which is set out like this: 1[Tab]Hello 2[Tab]Test into a Python dictionary how would I be able to do it? Thanks | |
Hello, so I've been working on a simple Tic Tac Toe game using TKinter graphics GUI. However i keep getting this error, and i'm not sure why. Any help would be greatly appreciated. Heres the code [CODE] import graphics import random def constructBoard(): win=graphics.GraphWin("Tic Tac Toe",500,500) win.setCoords(0.0,0.0,3.0,3.0) line1=graphics.Line(graphics.Point(1,0), graphics.Point(1,3)).draw(win) line2=graphics.Line(graphics.Point(2,0), … | |
I want to compare a list of files with extension .rtf in my directory with a list of files at a given url and download the files at the url not found in my directory. This is where I am at but cannot figure how to filter a list based … | |
This I did also after 'spying' discussions in other forum. Of course you would use sieve prime generation for bigger numbers, but I proved other simple way for a change. Slightly more advanced primes list generator would use primes % 6 in (1,5) property: [CODE]def primes(n): """ primitive non-sieve prime … | |
I'm working on a script in python,tkinter that draws a triangle and moves it around the screen. unfortunately I can't get the arrow to move. I've tried using canvas.move() but that wants an x and a y not the set of 3 coordinates I have to make it a triangle. … | |
I need help. I am very illiterate in Python and the like and I have a chunk of code that checks to see if a page updates and then posts it onto a forum. I need to alter it (hopefully) to check to see if an RRS feed is updated … | |
[code]def cDownload(): print("Enter package name ") sName=input print("Enter download location ") sLocation=input command = "wget http://aur.archlinux.org/packages/" + sName + "/" + sName + ".tar.gz -O" + sLocation + "/" + sName + ".tar.gz" os.system(command) [/code] I get TypeError: Can't convert 'builtin_function_or_method' object to str implicitly | |
ok someone please explain popen to me it runs subproccesses does this mean it can run programs from within my program? any help would be appreciated , there is not an easily spottable place that explains this. Thanks | |
It seems like dataRecived is not "firing" but I cannot work out why. Any ideas? Thanks [CODE] # Basic Chat Server # Imports from twisted.internet import protocol, reactor import pickle import string PORT = 6661 connections = [] class User(protocol.Protocol): def connectionMade(self): self.transport.write("Welcome") def dataRecieved(self, data): print data def connectionLost(self, … |
The End.