15,181 Topics

Member Avatar for
Member Avatar for mksha

Hi Guys, I am kind of new to python and started working on python from February2013. I have a script which run on linux machine. It captures the available RAM from the system and then tries to eat it up. I am using subprocess.Popen('free',...) command and for first loop it …

Member Avatar for mksha
0
465
Member Avatar for clouds_n_things

So, quick question, (has to be just something I'm missing), if I want to concantate a string and integers in a url, is there a way to do so? I'm sure there is...I mean this IS python! from urllib2 import urlopen width = input("Please enter a width specification here: ") …

Member Avatar for clouds_n_things
0
180
Member Avatar for johans22

import matplotlib.pyplot as plt plt.plot(x, y, 'b-') plot.legend ( ... ) 'put legend on left, i do not have the actual code with me. plt.show() How can I resize the plot window to show the legend on the left side?. Also, I like for program Not to stop when calling …

Member Avatar for Lardmeister
0
138
Member Avatar for clouds_n_things

So I'm writing a personal bank tracker for myself, and I'm having a bit of trouble with a line of code. The ID_Pin method below is equal to 0000, however when i try to create an instance (any instance of the Account class), it returns the "Access Denied" bit that …

Member Avatar for clouds_n_things
0
176
Member Avatar for dude1

i have a problem im trying to solve in python but I'm not sure if its possible ive got lists of data one line that is the full name Eg. name:John Doe and the line below is a the user ID Eg. userID:jdoe i have both of those being made …

Member Avatar for Lucaci Andrew
0
293
Member Avatar for welshly_2010

how can i add data to a label that i have and keep updating it based on the folder selected here my code so far def listDir(): dirname = tkFileDialog.askdirectory(parent=root,initialdir="/",title='Please select the file you would like to scan') myvar.set('Current Folder Selected is: ') label = Label(root, width = 30, height …

Member Avatar for vegaseat
0
167
Member Avatar for krystosan

why does this gives error `print "module {0}".format(key)` , i hope this is nt the python version problem...

Member Avatar for vegaseat
0
343
Member Avatar for vegaseat

A permutation is the arrangement of a set of items in different order. One interesting application is the rearrangement of characters in a word to create other words. If all the n characters are unique, you should get n! unique permutations. You can make a list of words unique by …

Member Avatar for vegaseat
1
6K
Member Avatar for vegaseat

Scientists and deficit spenders like to use Python because it can handle very large numbers. I decided to give it a test with factorials. Factorials reach astronomical levels rather quickly. In case you can't quite remember, the factorial of 12 is !12 = 1*2*3*4*5*6*7*8*9*10*11*12 = 479001600, that is 479 million …

Member Avatar for sneekula
2
5K
Member Avatar for rev_ollie

Hi, I'm doing some more work on my sensor program - and it now has a GUI and graph which I'm happy with. I'm having a look at a WX python tree - which looks like a good control for what I'm looking for. The question I have is this …

Member Avatar for rrashkin
0
218
Member Avatar for syfr

Hello. I'm a complete Python beginner and I'd like to know how to add a fail-safe to your code so that the script is stopped after a certain phrase or key combination has been given as input. To explain further, I'm playing around with a Raspberry Pi at work. I …

Member Avatar for Gribouillis
0
946
Member Avatar for sugarzzzz

I have a minelist[0,15] for a board 4 height and 4 width every elemnt in the board is a zero so it looks like [['0','0','0', '0'],['0','0','0', '0'],['0','0','0', '0'],['0','0','0','0']]now if I mines X in 0,15 it would look like [['x','0','0', '0'],['0','0','0', '0'],['0','0','0', '0'],['0','0','0','x']] now whereever the mines are touching it is …

Member Avatar for woooee
0
119
Member Avatar for ebc3142

Hi, After having come to grips with PHP, I've decided that it's time to move onto a more sophisticated language for building web applications. I've chosen Python, utilising the Django framework. Could somebody provide me with the software I will need for writing the code? My first guess would have …

Member Avatar for LastMitch
0
215
Member Avatar for abacus_x

Hi there! Ive been looking to get some help on a small script im writing to recover an encrypted word for homework. Its a 5 character word of random capital letters encrypted with the RSA algorithm. I undesrtand that Rsa is not a block cipher. Its been encrypted in two …

Member Avatar for blj.davidson
0
162
Member Avatar for carlpike

Edit: I've discovered that the problem isn't the code, but the proxy hangs for several minutes. Is there any way I can set a timeout for this socket so that it can just request a new socket after say 10 seconds? Also, the Timer class isn't working. The classes aren't …

Member Avatar for chriswelborn
0
157
Member Avatar for aVar++

Hello, I have made a programme for finding cominations of a number from the user, it is designed to take any length and then tell the user how many combinations there are. However im not sure how to find how many combernations there are. I have googled it and there …

Member Avatar for Ene Uran
0
285
Member Avatar for lancevo3

Hi all - Working on teaching myself some python and have some code I am working on, I am at a point where I would like to update a parent class variable from within a subclass, I am wondering what is the proper method for doing this. Something similiar to …

Member Avatar for Ene Uran
0
1K
Member Avatar for robert99x

I previously used 32bit Python 2.7 on Windows Vista. My new PC is Windows8 and 64 bit. I would like Python to work with Microsoft Office Excel. Is the best / simplest way forward to stick with 32 bit Python and 32 bit Excel? Can you mix 32 bit Python …

Member Avatar for vegaseat
0
311
Member Avatar for superbhimanshu

Hi, I am supposed to make a GUI using Tkinter which has basic menubar options, a optionmenu and some textboxes. Here is the code. from Tkinter import * ################ import basic libraries ################# import Tkinter import Pmw import tkMessageBox import tkFont from PIL import ImageTk,Image from mmap import mmap,ACCESS_READ def …

Member Avatar for vegaseat
0
424
Member Avatar for vegaseat

This snippet allows you to find the number of ordered permutations of items taken from a population of known size. It uses the well know algorithm with factorials. For very large populations you may want to use an approximation of factorials.

3
3K
Member Avatar for vegaseat

If you want to know the number of combinations of x things taken n at a time, you can use the Python module gmpy. The module gmpy is a C-coded Python extension module that supports fast multiple-precision arithmetic, very handy if x things reach a large number.

3
459
Member Avatar for dp121307

I wrote out a test for a Complex class on python but I'm getting an error. Here's what I have: class Complex: def __init__(self, real=0, imaginary=0): self._r=real self._i=imaginary def __add__ (self, other): return Complex((self._r + other._r), (self._i + other._i)) def __sub__ (self, other): return Complex((self._r - other._r), (self._i - other._i)) …

Member Avatar for TrustyTony
0
486
Member Avatar for krystosan

what does it mean by defining a variable with double underscore only at the prefix part ? like in this [example](http://pastebin.com/8e5t2eAZ) at pastebin i.e. self.__weakReference

Member Avatar for vegaseat
0
479
Member Avatar for flebber

I was reading this article [Click Here](http://maxburstein.com/blog/python-shortcuts-for-the-python-beginner/) http://maxburstein.com/blog/python-shortcuts-for-the-python-beginner/ In there was this example from itertools import combinations teams = ["Packers", "49ers", "Ravens", "Patriots"] for game in combinations(teams, 2): print game >>> ('Packers', '49ers') >>> ('Packers', 'Ravens') >>> ('Packers', 'Patriots') >>> ('49ers', 'Ravens') >>> ('49ers', 'Patriots') >>> ('Ravens', 'Patriots') So I …

Member Avatar for vegaseat
0
432
Member Avatar for longtomjr

I dont know what the responce will be but I kind of like the idea. Pls reply with critisim but pls stay polite. I have been Thinking if there can not be started something like a python guild. Run by an advanced python programer and the people part of it …

Member Avatar for longtomjr
0
195
Member Avatar for scubastevie

Hey all, I am working on learning python, I have a question about lists. When I call Variable x to equal numbers from a text file, I am getting the file returned in multiple lists. with open('numbers.txt') as f: for item in f: n = item.split() print (n) I end …

Member Avatar for Lucaci Andrew
0
225
Member Avatar for jevgeny.abramov

Sorry for my bad english, i have translated this task for fast, but i really neeed help. > Your task - to make automatic sfetofora (3d model). > > Traffic light works in three directions: to the two directions of movement of vehicles (in the center and from the center) …

Member Avatar for vegaseat
0
385
Member Avatar for vegaseat

This Python snippet shows how to control a VPython visual 3D sphere with Tkinter GUI toolkit button clicks.

4
3K
Member Avatar for sudipta.mml

How to save two images into two separate files using same python script. The two output images are correlation matrix and a graph. I was using matplotlib imshow(matrix, interpolation='bilinear') colorbar() savefig('/home/sudipta/Downloads/phppython/'+ filename +'.png') x = range(-width, width) plt.plot(x, avg_vec) plt.savefig('/home/sudipta/'+ filename +'plot' +'.png') The figures overlap each other when I …

Member Avatar for TrustyTony
0
401
Member Avatar for gangster88

how could i make the function to do the colours red, yellow and green for 5 sec delays and make the loop keep on going? [code] def trafficLights(): win = GraphWin() red = Circle(Point(100, 50), 20) red.setFill("black") red.draw(win) amber = Circle(Point(100, 100), 20) amber.setFill("black") amber.draw(win) green = Circle(Point(100, 150), 20) …

Member Avatar for TrustyTony
0
2K

The End.