15,190 Topics
![]() | |
Hi All, Im new to Python and doing a few basic exercises around modules and calling same. Can someone explain what par is in relation to this example? -------------- # Defining a module called support.py def print_func( par ): print "Hello : ", par return -------------- # Importing support.py module … | |
I am new here and it's my first post, so I'm sorry if this is in the wrong place or is formatted wrong. I made my first Python code, which is extremely simple, but I have a few questions I need clarified: This program asks the user to enter 3 … | |
Hi, I would like to add some descriptions to functions on top of every function ex : [Name = 'Test menu', Default=True, etc..] def test(): pass My actual scenario is , I create Menus dynamically by reading all methods from a module at run time. So i don't want to … | |
I have a block of code that i am wanting to turn into a function and i am very ocnfused on how to do it properly. If anyone could give me a lead on how to do this it would be a great help. The for statement is where i … | |
so I have this example, which I've slightly modded to get the simplicities out of the way: from PyQt4 import QtGui, QtCore HORIZONTAL_HEADERS = ("Surname", "Given Name") class person_class(object): ''' a trivial custom data object ''' def __init__(self, sname, fname, isMale): self.sname = sname self.fname = fname self.isMale = isMale … | |
**I genuinely hope this is the right place to post this question.** Anyways, I play video games alot and I really like them (I know playing video games won't help me make them ) But as I play them I keep on getting the urge to create my own video … | |
This is my first try with turtle graphics in Python. It is in fact a sort of "translation" from some old LOGO code. When you run it, this should be the result:  Insiders can perhaps play the "Dark side of the moon" record by Pink Floyd :) Any … | |
Hello. I am working in QGIS software in which backend python programming is used. I want to interesect a polygon with different lines passing through it, and find the width of that polygon in QGIS 1.8. The polygon is a shapefile ie .shp file. So please help me to complete … | |
Here some old fashioned line input routine, better idea nowadays would be to use GUI input box with real editing. Anyway, it is quite simple with Python to do this basic routine for terminal based program. | |
Why am I getting the above error message when I run this program? I'm running this program with an mp3 file as an argument, the mp3 file is in the same directory as the python program. There are 30 space reserved for the Title at positoin 125 from the end … | |
Im working on a small block of code that compares a argumented value to a file seached value. Every time i run the code it and give it the argumented value either lower or higher than i know the searched value is it gives me the opisite answer of what … | |
Based on this ideea **You just wrote a loop allowing the input of 20 names into a list. Alas, you made an error as you entered name number 17. Redesign your input loop, so you can correct the error easily without having to retype the previous 16 names.** I wrote … | |
I'm working on an IDE for a program I'm building, and just found out I need to use ast. I can't seem to find any decent examples to get me started on google... can someone help me out. :) thanks | |
So I have been working with a csv export for a few days now and I have the data almost in the form I need it in. I need some advice on how best to proceed to get to the soltuion I need. Here is the problem: My csv export … | |
I searched daniweb for related questions and google but i canot seem to find my problem in my code When I try to search for a word that exists in my list it returns false This is my code def main(): #the word that I am looking for word = … | |
Hi, I am very new to python and tried putting this code together in order to get an interface the size of the screenb but a canvas only half as tall: OFWidth=OedipusFrame.winfo_screenwidth() OFHeight=OedipusFrame.winfo_screenheight() OedipusFrame.geometry(("%dx%d")%(OFWidth,OFHeight)) OFSHeight = "%d/2" % OFHeight OTStart=Tkinter.Canvas(OedipusFrame, bg="blue", height="%d"%OFSHeight, width="%d"%OFWidth) All equations register correctly, but the frame … | |
I'm trying to write a program to get the artist and album from mp3 files. A simple test run on the Alice in Chanins song Rooster yielded this result -> `b'Rooster\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'` I set read to read(20) and if you count Rooster plus all the \x00s you'll see that it 20, … | |
a=[] f=0 print("BINARY SEARCH") print("ENTER NUMBERS IN ASCENDING ORDER") for i in range(0,9): k=int(input("ENTER THE ELEMENT AT ["+ str(i+1) +"]: ")) a.append(k) s=int(input("ENTER A NUMBER TO BE SEARCHED: ")) #print(a[1]) #exit() l=0 u=9 while[ l <= u ]: m=int( (l + u) / 2) if s==a[m]: f=1 break elif s>a[m]: … | |
I'm going to try and extract the artist and album from the meta data of an mp3 file with python but I need a little help. This is what I get on the tag line when I open an mp3 file in vim: ----> `ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿTAGRooster^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@Alice In Chains^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@DIRT^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@1992` This is what … | |
First am I missing any other notable ones? I only want to know about crossplatform standalone source-based modules, so no Gui IDEs. Tkinter Pyjamas wxPython PyGObject (Gtk's successor) Qt I already know that `Tkinter` is the default so it is the obvious choice for crossplatform because of its licensing and … | |
Hey I'm just wondering how to make pop-up windows in tkinter. | |
I have tried a written a code like so re.findall(r'[A-Z]{3}[a-z][A-Z]{3}',string) to find the solution for this python challenge http://www.pythonchallenge.com/pc/def/equality.html it seems so hard to figure out. I'm getting 527 matches and none takes me to the next level. Help or close hints will be appreciated | |
path = './file.txt' os.remove(path) import os `os.remove(path)` is equal to `os.unlink(path)`, so how can I delete the file if it just becomes unlinked? Also I haven't tried to yet, but does `'./file.txt'` work as is or do I must provide the full path? Or do I just need to use … | |
I have been stuck on this python challenge http://www.pythonchallenge.com/pc/def/ocr.html . I am familiar with python re module and regex but I don't seem to get what the challenge wants me to do. If there's anyone else that has been there, I'll need some help | |
Hi I just installed SciPy stack on Ubuntu 14.04. Then I installed python-pyglet. For testing it, I tried the following in python 2.7.6 interactive mode: from sympy import symbols,Plot,sin x=symbols('x') Plot(5*sin(x**3)+x**2) But the only result is « [0] : x ** 2 + 5 * sin(x ** 3), 'mode=cartesian' » … | |
client side code import socket import sys s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect(("localhost",9999)) path=raw_input("Please enter the complete PATH of your file : ") f=open (path, "rb") l = f.read(2048) while (l): s.sendall(l) l = f.read(2048) s.close() server side code import socket import sys s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.bind(("localhost",9999)) s.listen(10) while True: … | |
I'm trying to build an interactive IDE... the IDE has a file testing interface which displays a tree of the called functions in relation to the data in the file being tested. what I want to do is when you select a function referenced in the tree, it'll highlight that … | |
Program For Standard Form def stnfrm(a,b,c): one = (b/(2.0*a)) two = c-((b**2.0)/(4.0*a)) axis = one/-1.0 x = -b/(2.0*a) y = a*(x**2.0)+(b*x)+c print x if a == 1: print "(x + %f)**2 + (%f)" % (one,two) elif a == -1: print "-(x + %f)**2 + (%d)" % (one,two) else: print "%d(x … | |
Ok so I'm trying to make a inter face with a password. my plan is to have a window open up with an input box where you type the password and then when you have the right password it brings you to the second screen with the stuff on it. … | |
my code tries to generate a tree for reversi/othello but it runs into an infinite while loop and i am unable to debug it.The purpose of this code is to make minmax algorithm for the aiplayer.please help. import numpy board=numpy.array([[0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0], [0,0,0,1,2,0,0,0], [0,0,0,2,1,0,0,0], [0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0], [0,0,0,0,0,0,0,0]]) matrix_list=[numpy.copy(board)] points=[] decoy_list=[] … |
The End.