15,190 Topics

Member Avatar for
Member Avatar for jarograv

I have this code: [CODE]import csv tally=0 i=0 n=1 numb=2 count = sum(1 for row in csv.reader( open('cities.csv') ) ) cityname = csv.reader(open("cities.csv", "rb")) citynames = [] citynames.extend(cityname) for data in citynames: citynames.append(data[0]) tally+=1 if tally>=count: break tally=0 cities_x = csv.reader(open("cities.csv", "rb")) cities_list_x = [] cities_list_x.extend(cities_x) names = [] for …

Member Avatar for woooee
0
302
Member Avatar for novice20

Hello, can anyone help me regarding how this can be done? I need to declare an 'array' which has 95 indices, and each entry holds 8 bits each of data. am doing this with: PORT_MAP_LEN = 764/8 bit_map_len = [0]*PORT_MAP_LEN but it is giving me list index out of range …

Member Avatar for novice20
0
518
Member Avatar for Prahaai

Greetings, I'm using PyQt4 and trying to add a QGraphicsItem exactly in the center of the current screen, by clicking a menu button. So each click will add an item in the center of my screen. My QGraphicsScene is very large (10k X 10K), so the QGraphicsView cannot show it …

Member Avatar for Prahaai
0
1K
Member Avatar for tax

I have the following txt file that has 4 fields that are tab separated: the first is the id and the other three show the results per test. 152 TEST1 valid TEST3 good TEST2 bad 158 TEST2 bad TEST1 bad TEST4 valid . . . Based on the above txt …

Member Avatar for TrustyTony
0
163
Member Avatar for tikoti

Hi all, I have been doing for fun this problem in projecteuler.net. The problem is as follows: +++++++++++++++++++++++++++++++++++++++++ Peter has nine four-sided (pyramidal) dice, each with faces numbered 1, 2, 3, 4. Colin has six six-sided (cubic) dice, each with faces numbered 1, 2, 3, 4, 5, 6. Peter and …

Member Avatar for TrustyTony
0
513
Member Avatar for Shansal

Hi, I use [B]pulp[/B] module to solve my some optimization problems. With integer numbers, it works like a charm. I wonder if it is possible for pulp to work with real numbers. Here is a sample optimization problem I build for my project. [CODE] prob = pulp.LpProblem("example", pulp.LpMinimize) # Variable …

Member Avatar for Gribouillis
0
288
Member Avatar for aplh_ucsc

I do Get errors with combo box selections. here is my combo selection attach to a button. [CODE] def Btn9(self, event): # wxGlade: Appli.<event_handler> if self.combo_box_4.GetValue()=="1": numglobals.frame_12.Show() elif self.combo_box_4.GetValue()=="2": numglobals.frame_13.Show() elif self.combo_box_4.GetValue()=="3": numglobals.frame_14.Show() elif self.combo_box_4.GetValue()=="4": numglobals.frame_15.Show() elif self.combo_box_4.GetValue()=="5": numglobals.frame_16.Show() elif self.combo_box_4.GetValue()=="6": numglobals.frame_17.Show() elif self.combo_box_4.GetValue()=="7": numglobals.frame_18.Show() elif self.combo_box_4.GetValue()=="8": numglobals.frame_19.Show() elif self.combo_box_4.GetValue()=="9": …

Member Avatar for Gribouillis
-1
319
Member Avatar for Shansal

Hi, I have a list of lists such as : [[foo,1],[baz,1],[foo,0],[bar,3],[foo,1],[bar,2],[baz,2]]. I want to get all the different items in the inner lists and find the total number of them. I mean the result should be like : [[foo,2],[bar,5],[baz,3]]. How can I do this task? Thanks in advance.

Member Avatar for TrustyTony
0
172
Member Avatar for tucker001

I need to make an interactive program in Python that will start by asking the user to enter a list of numbers and then it will display the following menu. 1-Find The Maximum 2-Find The Minimum 3-Find The Average 4-Exit Please Enter Your selection Your program will accept a number …

Member Avatar for predator78
0
314
Member Avatar for s_jmp

hi all, i have loaded a dll with ctypes.cdll and i want to get thta dll's parameters and method like when you write: <'the dll handle'>. and just after you put the dot a list appears to show you the methods or like when you get a dir() from a …

Member Avatar for bunkus
0
527
Member Avatar for Stefano Mtangoo

Hi All, Its long have not been here. Python have been a language that have refused to get off my shoulders. After more than a year or two I'm back. And to cut story shot is, though I love Rhythmbox, It have the poorest Podcasting module I have ever encountered. …

Member Avatar for Stefano Mtangoo
0
284
Member Avatar for TrustyTony

This code determines if datetime object represent first workday of month, but it does not consider the special days like New Year (this year weekend but last year Friday). Reaction to Basic efforts in: [url]http://www.daniweb.com/software-development/legacy-and-other-languages/threads/362098[/url] There algorithm idea given by [URL="http://www.daniweb.com/members/jonkiparsky/775324"]jon.kiparsky[/URL] based docstring says 'workday' when it should be 'weekday': …

Member Avatar for TrustyTony
1
4K
Member Avatar for imperialguy

Some details of my machine and installed packages before proceeding further: [B]Mac OSX version: 10.6.6 Python version: Activestate Python 2.7.1 wxpython version: wxpython 2.8 (uses Carbon API hence limited to 32-bit mode arch only) [/B] I installed wxPython2.8-osx-unicode-py2.7 from wxpython website using their .dmg installer file. This package uses the …

Member Avatar for imperialguy
0
616
Member Avatar for hoangtuepchai
Member Avatar for HiHe
0
81
Member Avatar for HiHe

I was exploring random art and modified this nice example from vegaseat: [code]# random circles in Tkinter # a left mouse double click will idle action for 5 seconds # modified vegaseat's code from: # http://www.daniweb.com/software-development/python/code/216626 import random as rn import time try: # Python2 import Tkinter as tk except …

Member Avatar for HiHe
0
18K
Member Avatar for Thisisnotanid

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 …

Member Avatar for TrustyTony
0
246
Member Avatar for jkrueger

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

Member Avatar for jkrueger
0
954
Member Avatar for jarograv

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 …

Member Avatar for griswolf
0
2K
Member Avatar for Shansal

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]

Member Avatar for TrustyTony
0
53
Member Avatar for karlamadeus

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 …

Member Avatar for snippsat
0
115
Member Avatar for nagtan3

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 …

Member Avatar for TrustyTony
0
166
Member Avatar for tigerra80

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 …

Member Avatar for sneekula
0
2K
Member Avatar for laung

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 …

Member Avatar for TrustyTony
0
189
Member Avatar for novice20

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?

Member Avatar for snippsat
0
2K
Member Avatar for karlamadeus

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 …

Member Avatar for griswolf
0
225
Member Avatar for stan_l

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]

Member Avatar for snippsat
0
483
Member Avatar for HelloPeople1

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 …

0
102
Member Avatar for Eric Noa

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 …

Member Avatar for TrustyTony
0
8K
Member Avatar for RewindPlay

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]

Member Avatar for vegaseat
-1
126
Member Avatar for Fo.katia

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 …

Member Avatar for vegaseat
0
402

The End.