15,190 Topics
![]() | |
from __future__ import print_function, division #requested per VPython import time from visual import * #make sure this is asterisk char, copy/paste no go ## constants mzofp = 1e-7 L = 2.5 q = 2*1.6e-19 scalefactor = 7e-9 deltat = 9e-20 #objects & initial conditions particle = sphere(pos=vector(0,0,-4e-10), radius=1e-11, color=color.red) velocity … | |
I've been looking around for an answer to this but have had no luck. I need to take two files and print the top most frequent words they have in common as well as their combined(sum) frequencies. This might be simple but I'm pretty new to programming. Any help? def … | |
class BTNode(object): """A node in a binary tree.""" def __init__(self, item, left=None, right=None): """(BTNode, object, BTNode, BTNode) -> NoneType Initialize this node to store item and have children left and right, as well as depth 0. """ self.item = item self.left = left self.right = right self.depth = 0 # … | |
I have numpy type array, array[x][y], 16bit, little endian. How to save this to a tiff file as an image?. | |
Let's say I have a user input a string. string = input("enter a string") and that string ends up being something like "hello world!" but with a lot more whitespace. string = "hello world!" I want to condense this user's input so that instead of all that whitespace I only … | |
Hi Friends, I want to connect to a linux machine using a private key login as password from another linux machine. I want to connect this using a python script. Thanks in Advance, Omkar | |
So I have a code that prints out the `sys.argv` when the program is ran. How can I parse $ python ./arch.py install * to show `["./arch.py","install","*"]` Instead of `["./arch.py","install",#other files in directory]`? | |
Hi Friends, I had a issue with telnet conncection in python. Can you send me a working module to connect to telnet windows from a linux machine using python scripting.. Thanks in Adwance, Omkar | |
Anybody out there that used Python on an Android system? Something like the subset on http://pygame.renpy.org/ | |
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 … | |
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: ") … | |
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 … | |
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 … | |
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 … | |
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 … | |
why does this gives error `print "module {0}".format(key)` , i hope this is nt the python version problem... | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … ![]() | |
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 … | |
![]() | 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 … |
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 … | |
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 … | |
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 … | |
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 … | |
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. | |
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. |
The End.