15,406 Topics

Member Avatar for
Member Avatar for SgtMe

Hi again. I want to have a file for one of my python programs, that looks something like this: [CODE]<WINDOW> #Window size 640 480 <WINDOW TITLE> App Platform Test <ICON> icon.png[/CODE] I have a function that reads each line of, and uses the data to make a window. What happens …

Member Avatar for snippsat
0
16K
Member Avatar for jozz3

I have created a number guessing game that writes and reads scores from a text file. When a section of code was added to sort and right-align the scores from lowest to highest, a problem was encountered. This is my code: [CODE] import random print "Welcome to the Great CP1200 …

Member Avatar for jozz3
0
113
Member Avatar for pyprog

[CODE]list1 = [[],[],[]] list2 = [[1,2,3],[4,5,6],[7,8,9]] i = 0 j = 0 k = 0 while i < len(list1): list1[i].append(list2[j][k]) i += 1 k += 1[/CODE] I want my output for list1 to be [[1,4,7],[2,5,8],[3,6,9]]. The problem is I don't know how to advance through the lists in list2. Can …

Member Avatar for arunbg
0
163
Member Avatar for jozz3

Hello In my program I have a text file that I read from and write to. However, I would like to display the contents of the text file in an alligned and sorted manner. The contents currently read- name, score name, score Would I have to convert this information into …

Member Avatar for jozz3
0
2K
Member Avatar for brianlion1992

im new to python. just started today. learned a few things but not much. I have made 4 different menus each with a list of choices that executes certain functions. i want to make a 4 choice menu that can direct me to each one of the other 4 menus. …

Member Avatar for jcao219
0
130
Member Avatar for arunbg

Hi, I am working on a project in text mining using Python. As part of the project I need to use a technical term extractor, and I found the [URL="http://www.nactem.ac.uk/software/termine/#form"]Termine[/URL] system from NACTEM very useful. I have used the web demo (it's pretty nifty) and now want to integrate it …

0
109
Member Avatar for Hoss212

First some background, i am writing a stats program for my school, the way you enter stats is by a window that has a textbox that shows how many of that stat the player has, lets say pass thrown, and two buttons a plus and a minus to add or …

Member Avatar for Murtan
0
148
Member Avatar for Tommy.Leedberg

I have a Value Error that is caught, in the exception block when I have no problem printing to the terminal, however, i cannot insert any text into the text widget. Heres the code snippet, any ideas? try: if len( errorCode ) == 0 and len( errorCodeHex ) >= 1: …

Member Avatar for Tommy.Leedberg
0
123
Member Avatar for Simes

[CODE=python]#Code should always be in a method or class #Always start variable names with lowercase, classes could be capital #input.upper() allows the user to use lower or upper case for each option import random def isint(x): try: int(x) return True except: return False print "Invalid guess. " def getGuessValidator(): while …

Member Avatar for Simes
0
410
Member Avatar for camigirl4k3

I have most of it but I can't figure out how to word the last part. [CODE] def findLargest(L): largest = 0 for x in L: if x > largest: largest = x return largest def findSmallest(L): smallest = 300000000 for x in L: if x < smallest: smallest = …

Member Avatar for spiricn
1
250
Member Avatar for catcit

Hello! I am in the 11th grade and I have started with one of my colleagues to work on a file compression program based on Huffman coding. I have previously worked with python (a program that handles some .xls files) but this project is more complicated so I shall need …

Member Avatar for jcao219
0
150
Member Avatar for swish123

Hello, I have new to programming in python(have a little experience in C++) and to this forum. I am trying to write a program that finds Nth prime number; for example the 1000th prime number. Whenever, I try to run the program I just a see a blinking cursor and …

Member Avatar for woooee
0
150
Member Avatar for vrk6

Hi everyone, I am getting a error when using Xampp with mod_python addon and another python script Here is what I am trying to do, (I checked that the mysql server and apache server are running and refreshed. Also the config files was done correctly.) 1. First entered a string …

0
36
Member Avatar for john2oth

On the Unix machines,there is a file /usr/dict/words that contains a list of English words,one per line.This file is used by spell-checking programs for example. Write a python function which takes one argument,which is a word (as a string)and returns true if the word contains alternating vowels and consonants (i.e …

Member Avatar for Gribouillis
-4
322
Member Avatar for prashanth s j

Hi all, I have got a regular expression of the form: "tcp:"+'[0-9]+' It works fine when using the re.search( ) module. But if I want to grep for a line in a file that contains the pattern required, then the things wont work. Grep sees the regualr expression as tcp:+[0-9]. …

Member Avatar for prashanth s j
0
146
Member Avatar for «¤¦PR☼GRAM¦¤»

Well I have just started learning python and one of my first projects I have assigned is to find out every uniquely usable character (like the ones in my id) can be used in python. I would save them in file. I am not very good at writing the code …

Member Avatar for Tech B
0
302
Member Avatar for o0b3600

Hello, I found this website while I was trying to search a solution/ recipe for a problem I am trying to tackle... I am very new to python :( How can I run an executable file from a python script? for example: All the files (python script - filename.py-, executable …

Member Avatar for Gribouillis
0
276
Member Avatar for goodwin912

I did a project last year in VB for image processing, basically link to a folder, load an overlay and loop through the folder overlaying a watermark. I now need to get the same thing running in python to cater for cross platform use. I have translated all the image …

Member Avatar for goodwin912
0
155
Member Avatar for prashanth s j

Hi all, for the following string I want to search a pattern The string is lcpstr = "2008/03/25 log:true lcp: 78888 -> 100 lck=0 to=900 un=5840 l=0 BMN" If I take the pattern as "lcp: 78888", pattern checking is successful when I give the following statement: temp = re.search("lcp:"+" "+'[0-9]+'+" …

Member Avatar for snippsat
0
123
Member Avatar for ITgirl2010

This is the question i was given --------------------------------------------------- Here is a program that prompts the user to enter a student’s marks, and then prints out whether they have passed or failed a unit. '''calculate a students grade given their final mark''' def calcFinal( asg1, asg2, exam ): final = asg1 …

Member Avatar for snippsat
0
165
Member Avatar for garyinspringhil

I'm a newbie so please be patient... :) [CODE]def canvas(self): import qt self.setCaption('My Canvas') c = qtcanvas.QCanvas(self) # <- gives the canvas a parent QObject c.resize(315, 207) v = qtcanvas.QCanvasView(self) v.setGeometry(QRect(200,590,321,211)) lay = qt.QVBoxLayout(self) lay.addWidget(v) v.setCanvas(c) l = qtcanvas.QCanvasLine(c) l.setPen(qt.QPen(qt.Qt.black)) l.setPoints(10,10,390,390) l.show() v.show() c.update() l1 = qtcanvas.QCanvasLine(c) l1.setPen(qt.QPen(qt.Qt.red)) l1.setPoints(20,60,10,230) l1.show() …

Member Avatar for garyinspringhil
0
139
Member Avatar for mattj63

The askdirectory window in tkinter has a fixed size. My folders are deeply nested with long names. I would like to make the window larger so one can read the entire path. (I'm in WinXP) Is there a way to set the size of the askdirectory window or make it …

0
56
Member Avatar for qwertyui

i have 2 list contaning 4 element i must create 2 new list which contain 2 element 1st new list must contain an element from each original list 2nd list must also contain 2 element apart those of the 1st new list

Member Avatar for woooee
0
175
Member Avatar for davethebear10

I have to get three pieces of information from the files i have 1. The name of the owner of the file which appears after the pattern tag <foaf:name> 2. The ID of the owner of the file which is embedded in the filename, e.g., http%3A%2F%2Ftalk.ie%2Fvbulletin%2Ffoaf.php%3Fu%3D12 belongs to user 12. …

Member Avatar for woooee
0
253
Member Avatar for danizzil14

ok I had looked on the internet and found one form of running an exe file from a py script, i goes like this. [CODE]import os os.system("c:/windows/iexplore.exe") # Or wherever it lives[/CODE] Problem is, whenever i run the script with the appropriate path loaded in, i get the following: [CODE]Traceback …

Member Avatar for o0b3600
0
373
Member Avatar for SgtMe

Hi guys! I am in the process of making a game...similar to this one: [url]http://www.miniclip.com/games/nfl-lateral-collateral/en/[/url] I am using the following code to detect key presses: [CODE] pygame.event.pump() key = pygame.key.get_pressed() if key[pygame.K_LEFT]: ... [/CODE] How can I detect if a key is released? I have seen this done with using …

Member Avatar for tbone2sk
0
14K
Member Avatar for foxyenock

Write a python function which takes one argument, which is a word(as a string),and returns true if the word contains the same number of vowels as consonants. Then write a short piece of code to read the above file and print out all such words.For example the words such as …

Member Avatar for foxyenock
0
89
Member Avatar for tkpanther

I have been given an assignment to create a random race program where 2 different lines race. How the lines travel is determined by a random number generator, but that is not the issue I currently have. I am suppose to create a window that is 500x600, with the x- …

Member Avatar for ssmokincamaro
0
194
Member Avatar for camigirl4k3

A non-robot problem (Should be submitted independently). Write a Pyhton program, called Scores.py, which reads a collection of exam scores (integers) ranging from 1 to 100 and counts and prints the number of `A' scores, `B' scores, `C' scores, `D' scores and `F' scores based on the following grading scale: …

0
61
Member Avatar for duomaximus

Good day, any ideas on how to implement edge scrolling for wxPython. Panel used is a wx.ScrolledWindow here's a sample screen shot of the tool. The red areas indicates the edges of the map panel where the scrolling will be triggered. [url]http://i40.tinypic.com/wsmo95.jpg[/url] Thanks in advance!

Member Avatar for duomaximus
0
58
Member Avatar for garyinspringhil

I need a qtimer to trigger reading of a file line by line, I have the code working running with the timer trigger but qtimer will just read the first line over and over as it is now. Here is the code so far: self.lcdtimer = QTimer() self.connect(self.pushButton85,SIGNAL("clicked()"),self.update) self.connect(self.lcdtimer, SIGNAL("timeout()"), …

0
61
Member Avatar for GMUPATS

I am a student in my first python programming class in college and I am trying to figure out how to do my latest lab assignment. Could anyone just give my a hint on how to get a file (I know how to import it into the program) into dictionary …

Member Avatar for vegaseat
0
89
Member Avatar for bumsfeld

I am starting to play around with IronPython, but I can't figure out how to convert any code to executable file that will run on Windows. There has got to be some kind of batch file.

Member Avatar for jcao219
0
187
Member Avatar for prashanth s j

Hi all, I ahve got a requirement of searching for a string in a text file and then return that string. I also need to convert that to numerical value Could anyone please tell me how to do it? The requirement is precisely like this: First I need to search …

Member Avatar for bumsfeld
0
98
Member Avatar for jake2891

I am trying to write text into a windows edit control using python. it seems to write to every control i try except the edit box not sure if this is a security measure or not. here is my code any help will be greatly apprciated. [code] import os,sys,subprocess,time from …

Member Avatar for jcao219
0
169
Member Avatar for ccandillo

I am a programming and python beginner and thought this would be a fun exercise. I wrote this script to mine web pages. First it finds all of the hrefs on the page. Then it takes those urls and searches those pages for content. This is by no means perfect. …

1
66
Member Avatar for axa121

Hi, I'm processing a small text file which contains information about the Winter Olympics. However I don't know how to keep the list the same for each country whilst making a new list for a different country. So far I've read in the lines and I have put the data …

Member Avatar for axa121
0
92
Member Avatar for Tech B

My friend gave me 10,000+ ROM's for Sega, SNES, NES, and GBA. They where all individually zipped. I go fed up trying to unzip them one by one, and decided to write a script to do it for me. It unzipped about 5,000 in under a minute. Python's zipfile module …

Member Avatar for Tech B
0
623
Member Avatar for jozz3

Hello In my program I am using a menu that uses a multi-way if statement to do what the user inputs (1 of 3 values). After printing the menu I use a raw input statement to get the user's input. However, is there anyway to define the user's input variable …

Member Avatar for vegaseat
0
112
Member Avatar for pyprog

I am trying to write a program that prints every line of the file until a certain string is found. The file is a plain text file. I put the sample context at the top of the code. But the function gets stuck in an infinite loop. I don't want …

Member Avatar for IsharaComix
0
7K
Member Avatar for minimagician

Hi, the problem is that: I have a text file with some lines of text in it. I have to search for a particular line in the file and then copy the lines after the searched line into another text file. This search string comes only once in the text …

Member Avatar for rohini.vangury
0
7K
Member Avatar for emitan

Hi all. There might be a simple solution to this but I've been googling for quite a while for a solution... I want to get the plots generated by the module matplotlib from Python in an interactive window so I can save the graph. I'm using Ubuntu 9.10 and things …

0
65
Member Avatar for jozz3

Hello I'm writing a python program and need some help. Firstly, is there anyway to include variables in an input prompt? For eg. [variable1 = 4 variable 2= 3 variable= raw_input("Please enter a number between", variable 1, "and", variable2) ] Also, if data is being appended to the end of …

Member Avatar for jozz3
0
114
Member Avatar for ChargrO

hello I was just wondering if anyone knows of a site or someone (or start me off with some code) that could help me with learning about cascade menu's and changing them from a parent into a child, any help would be greatly appreciated. I am making the cascade menu …

Member Avatar for pythonNerd159
0
167
Member Avatar for persianprez

For my extra credit, I'm supposed to generate the longest chain from 1-1000000, I wan't to know if it is correct..here is my code: the caller [CODE] start = 1 end = 1000000 longest, chain = -1, -1 #choiceX(start) for i in range((end-start)+1): if choiceX(start) > longest: longest=start chain=choiceX(start) start+=1 …

Member Avatar for persianprez
0
96
Member Avatar for pythonNerd159

Hey people, i was just wondering if anyone knew the code to make a tkinter button... [CODE]def createExample(self): top=self.winfo_toplevel() top.rowconfigure(0, weight=1) top.columnconfigure(0, weight=1) self.rowconfigure(0, weight=1) self.columnconfigure(0, weight=1) self.Button = Button ( self, text=" Example", font=("Arial", 12), bg="white", fg="magenta", cursor="crosshair") self.Button.grid(row=1, column=0, sticky=N+E+S+W)[/CODE] ...and i wanted to know the code that …

Member Avatar for pythonNerd159
0
143
Member Avatar for Mensa180

Hello all! I was bored and upon my father's challenge I made a program that tells you the 20 day SMA for a specific date, I only have 100 days of data but can up that to over 8000 whenever I get my logic sorted out. The problem is I …

Member Avatar for Mensa180
0
169
Member Avatar for tran0191

I am doing a project where I read in a CSV file and I iterate through each row in the file. I then compare a specific column from each row, if a row with the specified column has the same value as another row with the specified column I would …

-1
56
Member Avatar for Oron123

hi, i have a big exe program that i wrote in c# (big means that i have a lot of class in it), i want to write a script in python that will check the program. what is the right way to check the program, convert the c# program to …

Member Avatar for jcao219
0
140
Member Avatar for Lylywhatever

i want the stars to appear in the night, but it only come out one?? can anyone help me what i should do to make about 50 stars randomly appear in the night?? thank you so much! [CODE]from graphics import * import random def stars(x,y): '''draw white line representing one …

Member Avatar for vegaseat
0
99

The End.