15,175 Topics
| |
Hey everyone, I have a set of classes which, when instantiated, take up a lot of memory. I'm trying to write a program which can inspect class attributes and methods given a list of classes, without actually instantiating them. Let's say I wanted to see if the following class had … | |
Hello, Ok so this is a fun assignment, but I just can't figure it out. My Python program should ask the user for a series of words, then fill in the proper places in the story using the user’s answers. We will use the [...] notation for placeholders. For example, … | |
Hello! I need to: 1. Prompt user for text file 2.Analyze file and graph (with bar plot)the 25 most frequent words with length greater than 4 3.The x axis needs to show the word. The a axis is the frequency. I've built the bulk of the program so far, but … | |
Hi there, This is my first time posting so I am sorry if its not perfect I am working on a FreeCell game right now where I need to deal a deck of cards into 7 separate piles. This is the code I have right now for dealing it into … | |
Hello, i'm back with new question :) So i found how to make non-blocking gui with threading: [CODE] class SearchThread(threading.Thread): def __init__(self): super(SearchThread, self).__init__() self.window = frame.panel_one self.window2 = frame.panel_two def run(self): seit = self.window.inputArea.GetValue() se = self.window.engine.filest(seit) for it in se: self.window2.transferArea.AppendText(it) [/CODE] and i bind it to check-box: … | |
helo, I learn Classes and methods according to a manual "Think Python: How to Think Like a Computer Scientist" I am stuck on "Polymorphism" There is a part using built-in function sum. I don't know what to do... It should be connected to __add__ function, but still the code must … | |
Hi Guys, I am trying to copy files from one location to another with administrator access in python. I dont have write access to the particular location but admin have. I want to copy those files with admin permission. This is very urgent. Thanks in advance. konnara | |
Hi all! I was hoping I could get some help. I have a input file of data in 5 columns eg. [CODE]A 1 10 B 0.7 B 1 203 A 0.98 C 2 805 C 0.99 ...[/CODE] So what I'm trying to do, is when each item in the first … | |
I am trying to code the hangman game.. i have the game running but i need to attach it to graphics.py. please help it needs to be done by midnight. here is my code so far the last parts just the ideas to atach it to graphics. [CODE]from graphics import* … | |
This snippet defines a simple decorator to post-process a function's return value through a sequence of filters. As a first application, the decorator can transform a generator function into a function returning a sequence type (list, tuple, dict). | |
Converting a decimal integer (denary, base 10) to a binary string (base 2) is amazingly simple. An exception is raised for negative numbers and zero is a special case. To test the result, the binary string is converted back to the decimal value, easily done with the int(bStr, 2) function. | |
[CODE]def countStrs(StrToSearch, pattern): count = 0 starting_point = 0 for element in pattern: while element in StrToSearch [starting_point:] : count += 1 starting_point = StrToSearch.find(element,starting_point) + 1 print "the string","'"+element+"'", "occurs", count, "times." def main(): file = open("pidigits.txt", "rU") lineStr = '' numbers =['0','1','2','3','4','5','6','7','8','9'] pattern =['1234','56789'] number_processor = 0 for … | |
Ive created a dictionary with all the letters of the alphabet, assigning each one to another random letter. encode={'b':'a','B':'A','c':'e','C':'E','d':'i','D':'I','f':'o','F':'O','g':' u','G':'U','h':'b','H':'B','j':'c','J':'C','k':'d','K':'D','l':'f','L':'F','m ':'g','M':'G','n':'h','N':'H','p':'j','P':'J','q':'k','Q':'K','r':'l','R':'L' ,'s':'m','S':'M','t':'n','T':'N','v':'p','V':'P','w':'q','W':'Q','x':'r','X': 'R','y':'s','Y':'S','Z':'t','z':'T','a':'v','A':'V','e':'w','E':'W','i':'x',' I':'X','o':'y','O':'Y','u':'Z','U':'z',' ':' ','!':'!'} Now what Im trying to do is to create a single function that takes the input, does the calculation, and produces the output, using … | |
input.csv 1,2,text, date, qwertyuiopasdfghjklñzxcvbnm, yhnujmik,2121212121 [code] import csv reader = csv.reader(open('input.csv', 'rb'), delimiter=',',quoting=csv.QUOTE_NONNUMERIC)) csv_out = csv.writer(open('output.csv', 'w')) for row in reader: content = row[0] + row[4] + row[5] + row[11] + row[12] + row[13] + row[16] + row[17] + row[22] csv_out.writerow( content ) [/code] # I want it to save … | |
Hi, i've used the Beautifulsoup module to parse the site and grab the img tag from it, but the problem is , Beautifulsoup while parsing not returning the whole content of the given url. The truncated content contain the image location I want to download: [CODE] from urllib2 import urlopen … | |
I was wondering if there is a way to record video from a USB webcam to a .avi file (including sound). I know how to view video and capture screenshots, but I'd like to be able to record a section of video. If there really isn't then is there a … | |
[B]Hello , I'm new here as I'm new in python.. :D I need help in viewing database's data ,[B][U] I could view data in python[/U][/B] but i need to view it in GUI . [B][COLOR="Red"]i'm using:[/COLOR] - Qt designer - pysqlite[/B] Thank you all :)[/B] | |
I want to translate text inputted multiple times then output it. I am using the maketrans() function. I want to translate multiple times, by a number of times a user would input. | |
This is my code for anagrams not utilizing the ready prepared file of anagram synonyms to celebrate 11.11.11 11:11:11. If you start program it warns you about missing subdirectory dict and creates it. You may put any word files, one word per line, to file <dictionary name>.txt. Program lists available … | |
i am new to Python. And I am trying to make a drop down menu which will have some options (eg 4 options). I also need a Ok button in the same window. The user needs to select an option and click on "Ok". I need only single selection. When … | |
Hey guys I've been trying extremely hard to get these functions to work but they don't unfortunately and I do not know whats wrong with it "beginner python user" I have to return a new list that contains items from the list image that pass the filter (a str)so far … | |
hey ppl Trying to get this code working for this gui cube game It is an assignment so i'm being honest, I have know idea on how to get the tkinker function to work. have searched the internet but still having problems in getting it too work. I have tried … | |
How are you guys doing today? I'm having a hard time with my CS project. I have to write a hangman python code but it is kinda different from what I've seen around. I'll post my code and then explain what I am having trouble with: [CODE]from hangman_support import * … | |
I want to take a function and repeat it by an amount which a user will input. Thanks in advance! | |
[CODE]class Personaje(object): def __init__(self,vida,posicion,velocidad): vida = None posicion = None velocidad = None recibir_ataque = None def recibir_ataque(vida): recibir_ataque in range(1,100) vida - recibir_ataque print "La vida actual del personaje es de", vida, " Luego de haber recibido", recibir_ataque, " de dano" def excepcionVida(vida): if vida <= 0: print "El … | |
I have this bit of python code that imports pygames to draw lines. It auto creates lines when two or more points are clicked on. I'm bad at explaining but you'll see when you run the code. It's pretty simple but I find it kind of fun to mess with … | |
Hey guys, I'm working on my game project for college, I have the code started, just enough to put the sprite on the screen and have a scrolling background. It is telling me there are no errors but when i go to run the game it terminates immediately, it's got … | |
Hi everyone....iam electronics engineering student and i have experienced some c++ ,i mean i know till oop basics... i want to learn scriptig language for EDA, i want to know which to learn...Perl or Python?....can python do everything perl can do??....i hear that perl is much harder to learn...is it … | |
Hi, I want to create a matrix containing 20 rows and 2 cols. I know how to do this, but I have these two files; number and amount (each file contains 1 col and 20 rows) and I don't know how to add these files into this matrix that I'm … | |
hi i'm having some trouble with web2py models: [CODE]# -*- coding: utf-8 -*- db = DAL("sqlite://storage.sqlite") from gluon.tools import Crud crud = Crud(db) db.define_table("shout", Field("author", "string"), Field("shout","text")) db.shout.shout.requires = IS_NOT_EMPTY [/CODE] (there is more but it is for the admin interface) It is all correct but I get this error: … |
The End.