15,181 Topics

Member Avatar for
Member Avatar for Tarkenfire

Okay, so yet another post here due to my utter confusion with this language...in all honesty, this isn't a question about threading, per say, lemme just demonstrate what I mean. This: [CODE]class RevoiceThread( threading.Thread ): def run (self): print "Remember to replace this line with the actual code" [/CODE] is …

Member Avatar for Tarkenfire
0
225
Member Avatar for stompper33

I'm a newbie to python and I have a problem. My problem is that I have a CSV file with hundreds and hundreds of rows of data. Each row contains temperature data that has been recorded daily. What I want to do is try to extract certain rows of data …

Member Avatar for Beat_Slayer
0
3K
Member Avatar for john125

Defining a Class Define the class rectangle. It's constructor takes a pair of numbers representing the top-left corner, and two other numbers representing the width and height. It has the following methods: * getBottomright() - return the bottom right corner as a pair of numbers. * move(p) - move the …

Member Avatar for Beat_Slayer
0
2K
Member Avatar for Sky Choi

I'm quite new in Python. I've been trying to solve this IndexError but couldn't get the answer yet. Need you guys advice or help. I want to extract the sentence matched with the keyword strSearch from 5gm-007 file(just text file). The error occured in "[COLOR="Red"]str5gram = lines[a][/COLOR]". here is the …

Member Avatar for Beat_Slayer
0
222
Member Avatar for ronparker

Hello all, I recently made a mysql database using python and imported an excel file into the database. However, I am having some issues with some of the python. Using the following code, I have selected 11 numbers from a table in the database. # c.execute('SELECT REF_PNL FROM actual_data_table WHERE …

Member Avatar for vegaseat
0
971
Member Avatar for Laurence26

I found this little program for a game in a book. [CODE]class Tank (object): def _init_(self, name): self.name = name self.alive = True self.ammo = 5 self.armor = 60[/CODE] It is named tank.py When I import it in python and I try to add [CODE]my_tank = Tank("Bob")[/CODE] Python gives an …

Member Avatar for umbuty
0
169
Member Avatar for acrocephalus

Hello! I am trying to redirect the stdout following the example in [URL="http://www.blog.pythonlibrary.org/2009/01/01/wxpython-redirecting-stdout-stderr/"]http://www.blog.pythonlibrary.org/2009/01/01/wxpython-redirecting-stdout-stderr/[/URL]. My code has some loops, and I would like the function to redirect stdout each time the loop is repeated, as it happens when running the code with the command line. However, it seems that in this …

Member Avatar for TrustyTony
0
857
Member Avatar for koveras vehcna

Hello everyone, I am currently teaching myself language processing by using the book of NLTK -found at http://www.nltk.org/book - and I have a problem. The following code retrieves every sentence in Shakespeare's Macbeth respectively as a list of list of list -or something like that- format: from nltk.corpus import gutenberg …

Member Avatar for koveras vehcna
0
244
Member Avatar for cleve23

Hi, Can i ask if there is any program that i can use to compile my python script that is using wxpython to an .exe application that can be run in mac os like what py2exe did for windows os? Thanks

Member Avatar for vegaseat
0
52
Member Avatar for Pinchanzee

My internet browsing skills have failed me and I can't seem to find any solution to this. I image it'll be easy for you guys though and I'd be incredibly grateful if you could help me. I'm new to Python so a relatively simple explanation would do me very well, …

Member Avatar for Pinchanzee
0
2K
Member Avatar for lewashby

According to the book I'M reading clock = pygame.time.Clock() creates a new clock object. But when I took a look at the time module, I didn't find a class by the name of Clock so I could I have an object? All I found was a function and it was …

Member Avatar for redyugi
0
45
Member Avatar for Axelro

Hello, How can I control the representation of my exponential number? 4.840000E+02 need to define how many numbers I want after the point? Is there a way to define it when I create it from integer? Thank you very much

Member Avatar for Axelro
0
214
Member Avatar for trihaitran

This is a really simple question but it's been stumping me for a while. I want to open a file that is in the same directory as the .py script, but I want to specify that directory without using a universal path. filepath1 = '/Users/username/Documents/Python/TC/TC cedict final.txt' file = open(filepath1, …

Member Avatar for dev.vini
0
729
Member Avatar for Axelro

Hello, My quaestion is how to convert an integer to an exponential number i.e. 484.000E-2? thank you very much

Member Avatar for Axelro
0
276
Member Avatar for danholding

hi there i need to collect the 6 latest backup files from a folder every day and currently working on a script to do this for me so far i have managed to pull the 6 latest files as shown in code below but the problem i have is most …

Member Avatar for danholding
0
109
Member Avatar for zoro007

Hello, I have problem with arithmetic in python when use it like this code [CODE]#!/usr/bin/python AA = open("a.txt").readline() print AA BB = 100 print BB + AA[/CODE] Appear to me this error : Traceback (most recent call last): File "aa.py", line 6, in ? print BB + AA TypeError: unsupported …

Member Avatar for zoro007
0
166
Member Avatar for nobleprog

Hi, We need a trainer to provide: [LIST] [*]Course: Phyton Programming [*]Outline: [url]http://www.nobleprog.co.uk/training/python-programming[/url] [*]Date: 31st Aug - 3rd Sep 2010 [*]Location: North Acton, London [/LIST] If you are interested or you know someone interested in providing this training please contact us [B]training@nobleprog.co.uk[/B] or alternatively by calling: [B]+44207 558 8274 [/B] …

0
128
Member Avatar for Ultralisk

[CODE]'''Triangle generator''' totalRows = int(raw_input ("Please enter a number: ")) stars = totalRows for currentCol in range(1, currentRow+1): for currentRow in range(1, totalRows+1): print '*', print print for currentRow in range (1, totalRows+1): for currentCol in range(1, currentRow+1): print '* ' * stars stars -= 1[/CODE] Current output: [CODE]* * …

Member Avatar for TrustyTony
0
92
Member Avatar for emchom

i am trying to create a program that uses * to make triangles depending on how big the user wishes to make them. This is the code i have so far however have no idea where to go from here.. can anyone help?? thankyou [CODE] def triangle(): totalRows = int(eval(input("Please …

Member Avatar for TrustyTony
0
240
Member Avatar for andrewtrench

Hi, all. I'm writing a little GUI thing to allow a user to specify variables in an xml file. I am battling to work out how to return all the .get() values from the Entry widgets back to a main application. The GUI is done as a function as the …

Member Avatar for andrewtrench
0
2K
Member Avatar for lewashby

[CODE]background_image_filename = "sushiplate.jpg" sprite_image_filename = 'fugu.png' import pygame from pygame.locals import * from sys import exit pygame.init() screen = pygame.display.set_mode((640, 480), 0, 32) background = pygame.image.load(background_image_filename).convert() sprite = pygame.image.load(sprite_image_filename) # The x coordinate of our sprite x = 0. while True: for event in pygame.event.get(): if event.type == QUIT: exit() …

Member Avatar for lewashby
0
832
Member Avatar for Ultralisk

[CODE]'''Triangle generator''' totalRows = int(raw_input ("Please enter a number: ")) stars = totalRows for currentCol in range(1, currentRow+1): for currentRow in range(1, totalRows+1): print '*', print print for currentRow in range (1, totalRows+1): for currentCol in range(1, currentRow+1): print '* ' * stars stars -= 1[/CODE] Current output: [CODE] * …

Member Avatar for griswolf
0
107
Member Avatar for Krstevski

Hello friends, I want to found some algorithms for text processing. I have a lots of entries in the database and now I want to split by category (news, history, sport, business etc...) but I don't know none algorithm(s) for text processing. So, my question is, what is the most …

Member Avatar for Krstevski
0
111
Member Avatar for revsin

I'm a noob, there got that outta the way. Wrote this to serve as a very basic inventory control for our store's iPad inventory. Lets junior employees count our inventory, and then appends the count in a text file. 99% there for what I want, but having trouble getting it …

Member Avatar for revsin
0
100
Member Avatar for PythonNewbie2

Can any one help me solve this? I've been struggling for days trying to make a working .exe file from one of my python scripts... All of the problems have been with Tkinter. It works perfectly fine when I use it in my script, but when I use py2exe or …

Member Avatar for vegaseat
0
230
Member Avatar for kadvar

Hi, I have a huge file (over 60 GB) which has lines in the following consistent format. "entry1";;"entry2";;"entry3";;"entry4";;"entry5";;"entry6";;"entry7";;"entry8";;"entry9";;"entry10";;"entry11" The problem is that a Few lines in this file have a line break precisely after the 3rd entry like this: "entry1";;"entry2";;"entry3\n ";;"entry4";;"entry5";;"entry6";;"entry7";;"entry8";;"entry9";;"entry10";;"entry11" I need to delete that extra newline and concatenate …

Member Avatar for kadvar
0
137
Member Avatar for AMW

Hi there I have some problem in creating a code. I have two text files one of them is English to spanish.txt and the other is English to Italiani.txt. I have to create language translator to convert an English word to either an Italian word or a Spanish word. I've …

Member Avatar for woooee
0
105
Member Avatar for acrocephalus

Hello! I would like to embed a terminal into a wxpython application where to print the outputs of the app (like Synaptic when installing Linux apps). I've been googling for a while but I found nothing. How can I do this with wxpython? Cheers! Dani

0
47
Member Avatar for acrocephalus

Hello! I am creating my first GUI with wxpython. It works right now, but I would like to tune it a little bit. My first issue is: how can I show the selected path/file beside browse button? I have uploaded the code, so you can figure out what I mean. …

0
64
Member Avatar for parijat24

[QUOTE]The actual file is as follows [/QUOTE] [CODE]>sp|P81928|140U_DROME 67 198 Tim17 8.9e-19 No_clan >sp|P20905|5HT1R_DROME 179 507 7tm_1 1.1e-97 CL0192 >sp|P28285|5HT2A_DROME 243 805 7tm_1 3.2e-73 CL0192 >sp|P28286|5HT2B_DROME 107 588 7tm_1 7.2e-82 CL0192 >sp|P13368|7LESS_DROME 439 520 fn3 1.4e-10 CL0159 1313 1380 fn3 3.4e-05 CL0159 1800 1890 fn3 3.6e-12 CL0159 2209 2481 Pkinase_Tyr …

Member Avatar for TrustyTony
0
150

The End.