15,185 Topics

Member Avatar for
Member Avatar for flebber

Hi I was doing an exercise in the Real Python book. It gave a task of simulating a coin toss "I keep flipping a fair coin until I've seen it land on both heads and tails at least once each – in other words, after I flip the coin the …

Member Avatar for flebber
0
2K
Member Avatar for in_xx

Hi, My project requires me to read in multiple ascii files and process them. So I am going to go through the data and using conditional statements store the result in lists. After this, I need to store this data and plot some of it using matlab and display the …

Member Avatar for vegaseat
0
477
Member Avatar for krystosan

in the code from mox example on their page [[http://code.google.com/p/pymox/wiki/MoxDocumentation](http://code.google.com/p/pymox/wiki/MoxDocumentation)] where does PersonDao comes from ? import unittest import mox class DaoUnitTest(unittest.TestCase): def setUp(self): # Create an instance of Mox self.person_mocker = mox.Mox() def testUsingMox(self): # Create a mock PersonDao dao = self.person_mocker.CreateMock(PersonDao) # Return a value when this method …

Member Avatar for krystosan
0
238
Member Avatar for asaidi

HI i m new in linux and i have on my pc linux mint,now i just installed python 3 in my linux.. how i can use the gui to write some scripts i m learning python..and in the tuto he shows the gui in windows very easy to write how …

Member Avatar for asaidi
0
96
Member Avatar for fonzali

hi , I have found vegaseats codes and tutorials helpful for biginners , how can I collect them in the pdf format?

Member Avatar for fonzali
0
156
Member Avatar for jeremywduncan

Hi again all, I have been tussling with this program all day. I can't seem to get pickle.dumps (or f.write..tried that earlier) to save without saving over itself. If I do a deposit(option 1) and then a withdraw(option 2), and then history(option 3), it only shows the last option ran …

Member Avatar for woooee
0
268
Member Avatar for tony75

Hi I would like to write the script that produces at least 6 encrypted password using crypt module and save them in a file called password.txt but I get error? and How can I add more than 6 encrypted password ? import crypt import random, string password = input("Please ender …

Member Avatar for tony75
0
660
Member Avatar for krystosan

I wrote this function earlier to set the priority if the items in listwidget, however what I think would be more pythonic is to write get and set priority method... how should i proceed with writing the method in a pythonic way ? def changePriority(self,direction): """ Reorder the items in …

Member Avatar for woooee
0
238
Member Avatar for 4evrmrepylrning

I'm trying to extract some metadata from a m4v file. I'm looking for the duration, height, width, etc. I do all my programming on a Raspberry Pi and was looking at gexiv2 but could not get it going. I got exiftool working though. My script looks like this: import exiftool …

Member Avatar for 4evrmrepylrning
0
3K
Member Avatar for tizzqman

I am trying to make a simple cryptography program using a simple subsitution method. If any one could help that would be nice. I need to be able to encode it as well as decode it. but im just a little confused on how to go about doing that. here …

Member Avatar for Lucaci Andrew
0
178
Member Avatar for jeremywduncan

This is for part of my homework in an Object Oriented Programming class. I debugged the top part to make it workable. I need help on how to delete a searched item and also think I am missing closing the database file at the end. The search function #2 is …

Member Avatar for woooee
0
209
Member Avatar for johnny0627

I don't get what's wrong with this code I keep getting a value error when i run this it says Traceback (most recent call last): File "rolling.py", line 40, in <module> dice1, dice2, dice3 = numb(dice) ValueError: need more than 2 values to unpack please help? def numb(dice): if dice …

Member Avatar for woooee
0
210
Member Avatar for krystosan

how should i readout data from shell to python script variables.. ? process = subprocess.Popen("rsh botham 'ps -eo fname | grep sublime'",shell=True, stdout=subprocess.PIPE) process2= subprocess.Popen('hostname')

Member Avatar for krystosan
0
332
Member Avatar for krystosan

parser = argparse.ArgumentParser('Utility to display SyncId information.') parser.add_argument('ids', help='list of ids to dsiplay information related to them.') becuase if i pass more than one value to the function from commandline , i get error of multiple values being passed saying error: unrecognized arguments: second third the first one goes through …

Member Avatar for Gribouillis
0
25K
Member Avatar for ebc3142

Hi, I've succesfully created a new project in Python Django, but when I try to run the server using: python manage.py runserver I receive this error: Validating models... Unhandled exception in thread started by <bound method Command.inner_run of <django.contrib.staticfiles.management.commands.runserver.Command object at 0x10166b250>> Traceback (most recent call last): File "/Library/Python/2.6/site-packages/django/core/management/commands/runserver.py", line …

Member Avatar for LastMitch
0
910
Member Avatar for james.lu.75491856

f = open(raw_input("File")).read().split() cows = f[0] data = dict(enumerate(f[1:],start=1)) print data nonloopy = [] loopy = [] def isloopy(cownum,data,did=[]): print " ",cownum,did cownum = int(cownum) if cownum in nonloopy: return False elif cownum in loopy: return True if cownum in did: return True if cownum == 0: return False did.append(cownum) …

Member Avatar for woooee
0
587
Member Avatar for zaphoenix

Hi, I have been trying to solve a problem,i need to write code to an existing projectile class to calculate the maximum height reached by a projectile ,i have tried all possible solutions but seem stuck,here is the code below # Canonball in form of a class # projectile.py from …

Member Avatar for zaphoenix
0
2K
Member Avatar for lancevo3

Hi All, I have a project I am going to be starting shortly, just recieved the specs. I plan on using python with flask for this project and the question I have (for now) just has to do with the python. My question is, this calculator is going to calculate …

Member Avatar for slate
0
144
Member Avatar for dirtydit27

Hello, I have the following code that using list comprehension to find even numbers in list L. L = [1,2,3,4,5,6,7,8,9,10] K = sum([(i) for i in L if i%2 ==0]) I wanted to know if this was the most efficient way to sum list K?

Member Avatar for dirtydit27
0
240
Member Avatar for tony75

Hi Im working with a python Odd numbers and my question is?. > An integer can either be odd (like 1,3,5,7,. . . ) or even (2,4,6,8,. . . ). > > 1. Write a python code which takes as input two numbers and displays all odd numbers between them …

Member Avatar for tony75
0
271
Member Avatar for mkweska

Hello all! I am sorry to have to waste your time with such an easy problem but I am stuck with some coders block on this one. I know it is definitely an easy fix I just cannot seem to wrap my head around it at the moment... I do …

Member Avatar for mkweska
0
268
Member Avatar for Steph102

Hi everyone. I am just learning Python on class so I am really at the basic. I need to write a python program that will flip a coin 100 times and then tell how many times tails and heads were flipped. This is what I have so far but I …

Member Avatar for Gribouillis
0
16K
Member Avatar for joseph619

i need to find density in video using optical flow in opencv python plz help me out to solve

0
107
Member Avatar for qbektrix

I am a newbie to Python. I just have 2yrs experience in C# Asp.net Web form. I have gone through a couple of tutorials but I am still not sure. So, I decided to do a project as a way of learning better and I need help and guidance to …

Member Avatar for cproger
0
167
Member Avatar for tony75

Hi I’m working with an old python exercise is to implement the caesar cipher, a simple encryption technique. Description of the methods can be found on the web (wikipedia) http://en.wikipedia.org/wiki/Caeser_cipher and the additional document. In short, each letter is replaced by another letter (like a is replaced by b, b …

Member Avatar for tony75
0
443
Member Avatar for delta_frost

I have this simple first multiprocessing code in pyton,but I encounter a BSOD when running it.Can anyone please point out what is wrong with it ? import multiprocessing def cracker(): print "Hello" return procs = [] for i in range(8): p = multiprocessing.Process(target = cracker) procs.append(p) p.start() for p in …

Member Avatar for delta_frost
0
585
Member Avatar for Ismatus3

Hello friends , I have two questions : 1) I was using psycopg2 for old versions of python 2.x , and now while using Python 3.3 , i can install psycopg2 , maybe it needs a special psycopg for Python 3.3 . 2) I could install py-postgresql , and i …

Member Avatar for Ismatus3
0
287
Member Avatar for entropic3105

I've been using Tkinter a little and want a program with the save and save as functions. Does anyone know how?

Member Avatar for vegaseat
0
302
Member Avatar for Fernando_1

the names and course and grade dont print, just the totals [Click Here](http://pastebin.com/BNz8VX3T) it reads a file text file [Click Here](http://pastebin.com/a2VjXjwz) the output should look like [Click Here](http://pastebin.com/Lt9uchM9) Im barely learning how to use the control break method and most of the program is broken up in functions. Im not …

Member Avatar for woooee
0
313
Member Avatar for dirtydit27

Hello, I'm currently working a project for class and I've gotten stuck. I am suppose to write a program that will read a csv file and create a text file with information from this csv file. So, far I have code that prompts for the file name and gives a …

Member Avatar for dirtydit27
0
460

The End.