15,148 Topics

Member Avatar for
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
221
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
970
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
854
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
51
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
728
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
275
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
108
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
91
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
239
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
831
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
110
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
134
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
46
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
63
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
148
Member Avatar for parijat24

hi, I am again involve in solving one trivial problem , that is I have a text file in which large number of entry are there like proteinid[COLOR="red"][/COLOR] sp|P13368|7LESS_DROME fn3 fn3 fn3 Pkinase_Tyr sp|P14599|A4_DROME A4_EXTRA APP_amyloid sp|P09478|ACH1_DROME Neur_chan_LBD Neur_chan_memb sp|P17644|ACH2_DROME Neur_chan_LBD Neur_chan_memb sp|P04755|ACH3_DROME Neur_chan_LBD Neur_chan_memb sp|P25162|ACH4_DROME Neur_chan_LBD Neur_chan_memb sp|P16395|ACM1_DROME 7tm_1 …

Member Avatar for parijat24
0
120
Member Avatar for danholding

hiya guys n girls, i am making a prgram where it sorts a list of files and pulls the 6 most recent files.. that is fine but i need it to pull 6 different dates ie... (this is what it does now test1 - 24/06/10 test2 - 24/06/10 test3 - …

Member Avatar for danholding
0
145
Member Avatar for pythonbegin

Dear all I have two text files. file1 with 42000 rows and 6 columns and file2 with 18 rows and 1 column. I want to match the entries in file2 with file1 either in column0 or in column 3. if the entry exist in any column. Write that line to …

Member Avatar for griswolf
0
135

The End.