15,406 Topics

Member Avatar for
Member Avatar for Guylolk

I'm getting "TypeError: unsupported operand type(s) for *: 'instance' and 'int'" It looks as if I am not setting a correctly and it would be great if someone could assist me with my problem. Thanks! [CODE=python] #! /usr/bin/env python from Tkinter import * import tkMessageBox tkMessageBox.showinfo("Text","Hello. Tell me any whole …

Member Avatar for dilettante80
0
231
Member Avatar for MichelleCrews

i dont even know where to start in this one lol ....... write a program to calculate and print the total parking charges for a customer at a long term parking lot. The charges are calculated according to the number of days parked at the lot. The parking charges for …

Member Avatar for MichelleCrews
0
2K
Member Avatar for DKDisco

For my Intro CS class I've been asked to write two programs, described as the following. def glyph(image): """Given a grayscale image, returns the corresponding glyph.""" and def text(image, glyphs, threshold): """Given a grayscale image, a list of 26 glyphs corresponding to the 26 uppercase English letters (in order), and …

0
44
Member Avatar for rj4gio

i have a lot of doc files to convert everyday. Any suggestion that help me to automate this conversion. Thanksssss :)

0
88
Member Avatar for amdpaul

Hi all I have just joined the site , as i have posted on other forums and i have had no replies back. I have a file named index.py and in this i have def index() and def show(), when i access localhost/index or localhost/index.py or localhost/index.py/show or localhost/index/show it …

0
45
Member Avatar for sandorlev

Hello! I started to create my own tiny 'framework' mainly built on the socket and the thread module. I haven't been doing too much thread programming before. My problem is that when I try server.waitForConnections(2), at the second connection, it says [code] Unhandled exception in thread started by Error in …

0
475
Member Avatar for doctorjo5

I know that this is an easy one but it is hard for me to figure out. I need to make a program that can: * Open the file and read through all of the lines in the file. (got this) * If a line starts with "Subject:", skip the …

Member Avatar for woooee
0
185
Member Avatar for hinz10

Hi I have a file, let's call it file.xml which contains information on the 1st and 3rd line (xml header and footer). What I would like to do is always write to the 2nd line so that the header and footer remain in the correct place. This is a gps …

Member Avatar for Gribouillis
0
97
Member Avatar for cnuzzo

I am using python 2.6 and am new to using Tkinter. I am trying to create a basic template GUI for a Toplevel Frame with multiple frames inside of it. I ran into an issue where I am not able to clear my frames properly. I think I have an …

Member Avatar for cnuzzo
0
1K
Member Avatar for Lolalola

[code=syntax] <div tal:define="number python: 1"> <tal:block repeat="item s_items"> <div tal:define="number python: number + 1"> <div tal:content="python: number">none</div> </div> </tal:block> </div> [/code] Hi, always show 2. but I would like to show 2 3 4 5 ... How to do? Thanks

Member Avatar for Lolalola
0
140
Member Avatar for madhaka

Vpython claims you can add and substract objects. All good and proper. Using 'frame', you can group or add objects together. Yes, but how do you subtract one object from another? How do you place a slot in a slab, or a round dent in a box?

0
42
Member Avatar for herrschteiner

Good day, I am attempting to write a Python script that has a given hexadecimal value, and a given list of strings. The script randomly samples the list and pulls out 3, 4-string lists. The strings are joined, converted to integers, converted to hexadecimal values, added together and the sum …

Member Avatar for herrschteiner
0
222
Member Avatar for MichelleCrews

ok ... first i had to make a function that tells you if the number you choose is a magic number or not ....(perfect number) ... i figured that out now i have to make a function that prints the magic number ... The second function, called print_magic, has a …

Member Avatar for MichelleCrews
-1
505
Member Avatar for elt6801

I have a task that sounds simple enough... but I don't code in Python; my background is in network design. So, here we go, I have to write a script that scans text files on a network share to parse for anything in the the text log that begins with …

Member Avatar for elt6801
0
169
Member Avatar for morgan505

Hi, I've been asked to write a program using Python to count the number of words in a sentance. The exact task is outlined below: Write a Python Program to count: (i) the number of lines (ii) the number of word (iii) the number of character in a text file …

Member Avatar for vegaseat
0
116
Member Avatar for dbbd

I'm using a modulu on a variable that has a hex numeric value, apparently I;m doing something wong: [CODE] import sys import fileinput if len(sys.argv) != 2: print 'Usage: ', sys.argv[0], 'val' sys.exit(1) offset = sys.argv[1] print 'offset=',offset mod = offset%4096 if mod != 0: print "unaligned: ",offset [/CODE] since …

Member Avatar for dbbd
0
258
Member Avatar for tziny

Hello, Do you know what is the regular expression for characters that are enclosed in quotes? E.g "python" "12345" Thanks

Member Avatar for The_Kernel
0
106
Member Avatar for lewashby

[url]http://ironpython.codeplex.com/releases/view/12482[/url] I'M running Ubuntu 9.10. On the website above, what which download should I use? I don't see a debian so I'M assuming I need to get the bin. If that's the case, I have no idea how to install a bin. Thanks for any and all replies. Wait, it's …

Member Avatar for JasonHippy
0
109
Member Avatar for spiricn

Ok first of all I'd like you guys to know this is like my first thread ever so go easy on me if I'm not doing something right :P Right then , so I've been programming in python for some time now and I love pretty much everything about this …

Member Avatar for spiricn
0
175
Member Avatar for shyami

Hello there, i created a webservice in php using SOAP. Now i need to invoke that in my python. Here is my php code soapserver.php [CODE] <?php function getSessionData($sid) { mysql_connect('localhost','root',''); mysql_select_db('database'); $query = "SELECT Uname FROM tablename"; $result = mysql_query($query); $row = mysql_fetch_assoc($result); return $row['Uname']; } require('nusoap.php'); $server = …

0
59
Member Avatar for sammakko

hi, my problem I can't solve: each of my two lists consists of an ID and runID. The output I need are those elements who are not in list2 and the max Value of runID of each ID. e.g. list1 = [('1101', '2'), ('1101', '3'), ('1101', '4'), ('4472', '2'), ('4472', …

Member Avatar for sammakko
0
89
Member Avatar for rpjanaka

Hi all, Is there a way to get system memory consumption and CPU consumption in a platform independent way, using python...? Basically my requirement is, get the memory status and CPU status of a particular process. If there is a way to get memory info and CPU info by just …

0
58
Member Avatar for heValbo

Hi! I would like to make an ordinary dictionary from english to norwegian, but I have a problem. I am using this sentence as an example: "I read the book" The problem isn't the first two words, but the last ones. :-/ The program should replace "the book" to "boka". …

Member Avatar for Gribouillis
0
119
Member Avatar for katharnakh

how to create a submenu in python? how to use [I]insert_cascade(index,**options)[/I].......... please help me out.

Member Avatar for skydiverman05
0
4K
Member Avatar for 1988asso

HELLO! I am working with wxPython libraries .... I used the library 'Notebook' to create 3 tabs .... How do I put in one of these tabs a toolbar? how can I do?? Help! thanks!

Member Avatar for vegaseat
0
117
Member Avatar for Stubaan

Hi folks - I think I'm almost there... I have files with data in this format: ID1 ID2 Dist 1 a 50 2 b 20 3 c 10 2 c 100 4 c 80 4 a 70 1 a 90 2 a 34 3 b 5 2 b 6 1 …

Member Avatar for Stubaan
0
182
Member Avatar for txwooley

I am trying to put a terminal into my tk gui program as a widget. I figured out how to have the output of a command sent to a text widget: [CODE] root = Tkinter.Tk() tfield = Tkinter.Text(root) tfield.pack() for line in os.popen("run_command", 'r'): tfield.insert("end", line) root.mainloop() [/CODE] But how …

Member Avatar for txwooley
0
11K
Member Avatar for Tops

I have a python assignment that has to do with character occurrence. I have to extract all the characters (letters to be precise) in a poem and count how many of each letters there are. For an example: Bobby goes to school blahhhh blahhh blahhh To: B---6 o---5 y---1 ...etc …

Member Avatar for bvdet
0
106
Member Avatar for gridder

Hi, Wonder if anyone here can help with this: I'm trying to split each line of data from a text file into a list or tuple. The lines contain a mixture of ints, floats, and strings (with spaces). I can do it easily enough using split() twice - once by …

Member Avatar for gridder
0
124
Member Avatar for chavanak

Hi, I have written a python script that acts as a wrapper around an executable. Here is the code: [CODE] import os import sys import string import csv usage = "usage: Specify the directories for files and the RDOCK cut-off value" if len(sys.argv) < 4: print usage sys.exit() else: first_folder …

0
70
Member Avatar for iloveannaw

Hi, we started doing programing at uni and i got interested so am learning some python at home. just started on generators and thought i'd write a function to generate prime numbers, as you do: [CODE] def primes(p=2): while True: for n in range(2,p): if p % n == 0: …

Member Avatar for Gribouillis
0
70
Member Avatar for 1988asso

hello! I am working with the libraries WX-Python ... I wonder if you can create a button that can be selected and then dragged into a panel?? Can someone help me make this thing or give me some suggestions to do it?? Help! thanks!

Member Avatar for 1988asso
0
31
Member Avatar for edy_sze

Hey Guys I've got a Python function that is slowing the efficiency of my program down and was wondering if anyone could give me some pointers on how I could make this function more efficient ? The function is used for converting a integer to a base 16 number. [CODE]def …

Member Avatar for edy_sze
0
137
Member Avatar for firstimer04

Evaluation of formula G =((p→q) ^p)→q and the output display the result of true false' conclusion if it is a valid, invalid or inconsistent.. thank you for any response its a big help to my study her's my unfinished code [code] import sys p=(True,True,False,False) q=(True,False,True,False) def p_AND_q(p,q): print p,"\t", q, …

0
45
Member Avatar for SoulMazer

Hi, so in essence I have two little scripts: a server side script and a client side script. My client script sends a request to the server, and the server sends a string to the client. Once I get the string back into the client, I set it to the …

Member Avatar for SoulMazer
0
2K
Member Avatar for kfancy

Does anybody have an example of how to split or double down in a blackjack program?

0
51
Member Avatar for germ

Hi I am new at python, so say I have a text folder with many number records in a single column how would I go about extracting only numbers that begin with zero and is either 10 or 7 digits long creating a new txt file for the 7 digit …

Member Avatar for vegaseat
0
159
Member Avatar for mathijs

Hi, i'm running a server in my basement. ubuntu running xampp. And i was wondering if anyone can point me to some good uses of python to use on my server. i'm a bit low on inspiration. I know there's Django and also mod_python. But it doesn't have to be …

0
84
Member Avatar for bharatk

I have function in my program calls a class which opens a new window [CODE]class TopLevel3: def __init__(self): self.root2 = Toplevel() self.canvas3 = Canvas(self.root2, width=400, height=200) self.canvas3.pack() self.root2.title("ImageDB") r = 0 for c in range(6): Label(relief=RIDGE, width=55).grid(row=r, column=0) Entry(relief=SUNKEN, width=20).grid(row=r, column=1) Button(text='View Image').grid(row=r, column=2) Button(text='Update Tag').grid(row=r, column=3) r = r+1 …

Member Avatar for bharatk
0
118
Member Avatar for Purnima12

I wish to create a program that informs the user whether a given date is a holiday or not - Here is how it should work: The student should be prompted to enter an integer for the month and then prompted to enter an integer for the day. (For example, …

Member Avatar for woooee
0
163
Member Avatar for shyami

Hi, Is it possible to include php file in python? in my application already header and left menu and footer are existing in php. i want to include those files in my new python script. Plz tell me how to do this? Thanks in advance -Shyami

Member Avatar for slate
0
77
Member Avatar for Logi.

I'm having trouble combining tkinter windows/functions, i have simplified my problem down to this which i think seems to be the problem. Both these functions will work on their own, but not together. (at least the way i want them to!) What I am after is to be able to …

Member Avatar for bharatk
0
8K
Member Avatar for AnnetteM

Hello, I would like to execute a double for-loop in python. I use the python interface with ArcGIS (hence the gp. prefixes and weird functions). Here is my double-for loop attempt but I can't execute the code due to 'invalid syntax.' If I remove the bottom loop, the code runs …

Member Avatar for AnnetteM
0
1K
Member Avatar for gloris

Hi, What is the best way to find the process name and owner? Now i use WMI, but this version is too slow.

Member Avatar for woooee
0
65
Member Avatar for jjrrmm

Hi everyone. we have an assignment that asks us to count the number of occurrences in a piped raw input text file and print it, calculate its phi statistic, the expected phi for english and the expected phi for random and then print them all out. also, at the end …

Member Avatar for woooee
-1
243
Member Avatar for PixelHead777

OK, so I made a FastScrabble game. My code is currently: [CODE]from random import * from itertools import * scrabbletiles = [] showntiles = [] def drawtile(): nexttile = sample(scrabbletiles, 1) scrabbletiles.remove(nexttile[0]) showntiles += nexttile def possibilities(): possi = [] for i in range(2, len(showntiles)+1): for word in permutations(showntiles, i): …

Member Avatar for Gribouillis
0
149
Member Avatar for RatulSaha
Member Avatar for vegaseat
0
147
Member Avatar for nimmyliji

Hi, How can i generate recurring dates using python? For example i want to generate recurring date for "Third friday of every 2 month". I want to generate recurring dates for daily,weekly,monthly,yearly that is same as the recurrence function in outlook express..... Thanks in advance. Nimmy

Member Avatar for vegaseat
0
143
Member Avatar for lsy_19830908

i want to make a treelist by using Boa Constructor. first, i make a new frame, and then add a new treelist in the frame, but i can not find any key or table to let me add items in the treelist. so i typed several Python code in the …

Member Avatar for vegaseat
0
458
Member Avatar for Andy_Ballard

I would like to construct a neighbour list of multiple atoms. [CODE=python] AllAtoms = {} AllAtoms[0] = [0,[]] AllAtoms[1] = [0,[AllAtoms[0][0]]] AllAtoms[2] = [0,[AllAtoms[0][0]]] [/CODE] Every member of the dictionary is referencing other members of the dictionary. I do not know how to make this reference work so that when …

Member Avatar for Andy_Ballard
0
233

The End.