15,175 Topics

Member Avatar for
Member Avatar for hughesadam_87

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 …

Member Avatar for hughesadam_87
0
219
Member Avatar for Joey7

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, …

Member Avatar for TrustyTony
0
132
Member Avatar for Joey7

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 …

Member Avatar for woooee
0
151
Member Avatar for ThisBoy

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 …

Member Avatar for woooee
0
122
Member Avatar for Creatinas

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: …

Member Avatar for Creatinas
0
191
Member Avatar for vlady

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 …

Member Avatar for vlady
0
124
Member Avatar for konnara

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

Member Avatar for Gribouillis
0
29
Member Avatar for Emred_Skye

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 …

Member Avatar for Gribouillis
0
275
Member Avatar for pelin

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* …

Member Avatar for woooee
0
149
Member Avatar for Gribouillis

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).

Member Avatar for Gribouillis
2
571
Member Avatar for vegaseat

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.

Member Avatar for Gribouillis
1
7K
Member Avatar for darkmetal

[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 …

0
46
Member Avatar for PlUmPaSsChIcKeN

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 …

Member Avatar for PlUmPaSsChIcKeN
0
168
Member Avatar for sys73r

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 …

Member Avatar for sys73r
0
196
Member Avatar for hemant_rajput

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 …

Member Avatar for Gribouillis
0
458
Member Avatar for blaze423

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 …

Member Avatar for ashely97
0
2K
Member Avatar for mina_k

[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]

Member Avatar for robert99x
0
54
Member Avatar for A.D.M.I.N

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.

Member Avatar for woooee
0
299
Member Avatar for TrustyTony

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 …

0
2K
Member Avatar for rickymohanty

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 …

Member Avatar for Stefano Mtangoo
0
29K
Member Avatar for stevenm119

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 …

0
115
Member Avatar for unmatchedz

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 …

Member Avatar for unmatchedz
0
209
Member Avatar for BWall

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 * …

Member Avatar for woooee
0
180
Member Avatar for A.D.M.I.N

I want to take a function and repeat it by an amount which a user will input. Thanks in advance!

Member Avatar for Ene Uran
0
85
Member Avatar for Nachodsk

[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 …

Member Avatar for SgtMe
0
246
Member Avatar for shurshot

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 …

Member Avatar for Ene Uran
0
3K
Member Avatar for Dann0

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 …

Member Avatar for Dann0
0
185
Member Avatar for geosparovany2

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 …

Member Avatar for Tumlee
0
228
Member Avatar for sofia85

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 …

Member Avatar for Gribouillis
0
153
Member Avatar for SamarthWiz

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: …

Member Avatar for SamarthWiz
0
246

The End.