15,175 Topics
| |
Hi all, I was working on a MATLab program and I came to a point where I wanted to define a function such that one of the arguments would be used as a command. To clarify, the function being defined was an implementation of Simpson's rule that would integrate using … | |
Hi, Noticed on the Mac that after a script runs the terminal is still there and not usable, one has to control q it to go away. Is there a way to have the script quit the terminal from the script when it ends? Thanks, jkrueger | |
Currently I am making code to be used to make my playing of an online conquest video game easier. The first program the user would run is the initialize program. This is how the program looks: [CODE] #initialize import csv x=1 y=1 n=0 citiesx=[] citiesy=[] city_names=[] total=input("How many cities do … | |
When I try to open an excel file by calling EXCEL itself from python, I cant see any Excel file opened . How can I fix that? Thanks in advance. The code I use is: [CODE] import os from win32com.client import Dispatch xl = Dispatch('Excel.Application') wb = xl.Workbooks.Open(os.path.abspath("Modules.xls")) [/CODE] | |
Hi guys, I am a bit new to OOP in general, and I was just wondering if I am going around what I want to do in the right way. I am making a small game to try to learn OOP and in this game I have several classes for … | |
Hi, I am developing a website, I Have to get the google map on the basis of a particular location which i would get from an object of the database. This ill use it from the template language. For example: [B]person.address[/B] is what ill refer and i should get the … | |
My assignment is to write a golf program that tallies the scores and prints out names and final scores in this format: Player4:21, Player2:33 etc etc. My question is can you use the range function to assign input to the proper variable name in Python 2.7. Here's what I have … | |
My coding here: [code] option_input = raw_input(">>>") option_input = option_input.upper() if option_input == "V": print "High Scores:" saveFile = open("scores.txt", 'r') scores = saveFile.read() saveFile.close() nameScore= [] for line in scores.split('\n'): # skip any empty line if not line: continue userScore, score = line.split(',') #convert score to a numeric value … | |
Hi, I am working with [B]python2.4 on windows[/B], and want pysnmp to be imported. Have downloaded [B]pysnmp-4.1.14a.tar.gz[/B] and [B]pyasn1-0.0.12a.tar.gz[/B] and put it under [B]D:\Python24\Lib\site-packages\[/B]. Still i am getting the import error. from pysnmp.entity.rfc3413.oneliner import cmdgen ImportError: No module named pysnmp.entity.rfc3413.oneliner What should I do to make pysnmp importable? | |
Hello all. I am trying to write a short little game, mainly to boost my knowledge of classes and objects, and of course I am starting to encounter problems. I have several classes for different types of creatures in this game. Most of them take the form of: [CODE] class … | |
After reading a reply to a post regarding importing modules, help("modules") was suggested as a means to display what is currently available. I tried it and got errors after only performing a basic install of Python 2.7 and Python for Windows. Can these be repaired [see attached] | |
Hi guys I'm writing a top down shooter game in pygame and wanted to use sprites for my object. I got a character sprite working fairly well except I have two problems. 1. When I rotate my character the point of rotation is changing. This causes a uneven rotation in … | |
Im taking Intro to computer programming and I have to designed a program in python that reads the numbers on a .txt file and then adds those numbers and display the sum to the user. Very simply program but I can't get it to work. I know sure how to … | |
Using functions, how would I print the lowest, highest, and average of my PAY list? [CODE]try: text_file = open ("Pay.txt", "w") text_file.writelines(Pay) text_file.close() except (IOError): print 'Error opening/writing Pay.txt' try: text_file= open("Pay.txt","r") PAY= text_file.readlines() text_file.close() PAY.sort()[/CODE] | |
I have to write a program in Python that creates two circles colliding to each other and to the sides of the window. Here is what I have so far, but the problem is that they don't collide and they don't bump against the walls. Please tell me what i'm … | |
I have a simple question with Python numpy. I have a numpy array as follows. [CODE]a = [ [1000 2 3] [4 5000 6] [7 8 9000] ] [/CODE] I want to be able to print 3 slices of the array to a txt file so that the elements in … | |
Hi, I'm a Linux user, and have general knowledge of windows. OK, have cygwin terminals working and have colorama and termcolor modules working. Colorrama allows use of termcolor on windows. So, when doing quick scripts that have some color in them programed on Linux I can quickly cxfreeze them on … | |
Hey guys, Couldn't find the answer to this question in any old threads, probably because I don't know the terminology involved well enough. I have a program which takes in data and writes it into a numpy array at the beginning of a pipeline. I use a class called Masterarray … | |
What would be the loss if Python was fully interpreted instead of having a hybrid (compilation + interpretation) model of implementation ? | |
hello, I just signed up to ask...How would I store the information from my code(see below) into a object? I'll be naming the object employees. The code I have now executes this:(please tell me if there are any mistakes on the code I have so far) 1.Ask the user to … | |
I have this psuedocode: [QUOTE]FUNCTION initialize FOR row = 1 to num_items get random number for the list ENDFOR ENDFUNCTION initialize FUNCTION show FOR row = 1 to num_items show output: list(row) ENDFOR ENDFUNCTION show FUNCTION sort FOR pass = 1 to num_items posn = 1 sorted = True WHILE … | |
Hi i'm trying to make a basic snake game. However i cannot seem to be able to display any food. I have tried numerous different ways but i just can't get anything to show :@. I simply want a red rectangle that will display in random places everytime the snake … | |
hi there ,,, im new to this forums and i really need somehelp in paython as i've got this homework and i need somehelp with it !! ,,, and im so stuck in it ! 1.Write a function to find average of a series of numbers entered by the user. … | |
Hi I am new to python. I am trying to get my fraction program to work but I keep getting this error message: Any advice would be helpful! [ICODE] File "main.py", line 5, in ? from fraction import* File "/home/students/bf133052/CS4223/fraction.py", line 10 def__init__(self,numerator,denominator=1): ^ SyntaxError: invalid syntax [/ICODE] here is … | |
how do I catch changes to a mutable object ie: [CODE=python] class test(object): def __init__(self): self.x = [] def __getattr__(self, atr): print 'retrieving atr %s' % atr return self.__dict__[atr] def __setattr__(self, atr, val): print 'setting atr %s to value % s' % (atr, val) self.__dict__[atr] = val [/CODE] >>> instance … | |
Response to hijacker of thread: [url]http://www.daniweb.com/software-development/python/threads/59745[/url] | |
Hi there, I've been trying to create a memory test game, but been trying to figure out a way to get the output to display for a limited amount of time, any suggestions geeks in the house. | |
I have just started looking at simple cryptography in order to learn python better. Encryptions and decryptions should be speedy and accurate so im hoping it will improve my programming skills. I recently wrote this quick script for a shift cypher but i wasnt sure how to be able to … | |
can anyone please send me the code for marking an object in two successive frames???? please its very urgent.... | |
Hey, everybody, I'm a newbie at Python (2.7.1), and new to DaniWeb as well. and the apparent simplicity of Python got me interested in programming (seriously, the only thing before this was HTML). Anyway... I was taking a test and thought that after I was finished I could make an … |
The End.