Re: [Tutor] folder and file list

2011-05-10 Thread Tommy Bell
On 11-05-2011 00:08, Jorge Romero wrote: Is there any special reason for deploying that functionality from scratch by yourself? Can't you use os bulit-in module? Perhaps you can find this useful http://docs.python.org/library/os.html#os.listdir. That way you don't deal with OS peculiarities s

[Tutor] create an xls file using data from a txt file

2011-05-10 Thread tax botsis
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 I need to create an xls file having as headers ID, TEST1

Re: [Tutor] Programmatically Post to Pastebin

2011-05-10 Thread James Thornton
Pocoo (the creators of Flask) have a Python API for a pastebin they developed called LodgeIt. You can use the hosted version, or the download the source code and host your own (http://www.pocoo.org/projects/lodgeit/). http://paste.pocoo.org/ http://paste.pocoo.org/about/ http://paste.pocoo.org/hel

Re: [Tutor] Programmatically Post to Pastebin

2011-05-10 Thread James Mills
On Wed, May 11, 2011 at 9:57 AM, Lan Rogers wrote: > I want to post files stored on a machine to Pastebin (or any similar > service for that matter) using a python script, and then store a link > to that post. Also, I would strongly prefer to avoid doing something > that requires an API key. A si

[Tutor] Programmatically Post to Pastebin

2011-05-10 Thread Lan Rogers
I realize this may not be entirely within the domain of a python mailing list, but I'm having trouble finding anything helpful elsewhere. I want to post files stored on a machine to Pastebin (or any similar service for that matter) using a python script, and then store a link to that post. Also, I

Re: [Tutor] folder and file list (Jorge Romero)

2011-05-10 Thread Robert Sjöblom
>> >> >> >> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >> >> >> > Can't you use os bulit-in module? > > Perhaps you can find this useful > http://docs.python.org/library/os.html#os.listdir. That way you don't deal > with OS peculiarities such as the one Bret

Re: [Tutor] folder and file list

2011-05-10 Thread Jorge Romero
Is there any special reason for deploying that functionality from scratch by yourself? Can't you use os bulit-in module? Perhaps you can find this useful http://docs.python.org/library/os.html#os.listdir. That way you don't deal with OS peculiarities such as the one Brett Ritter pointed. On Tue,

Re: [Tutor] Graphic interface

2011-05-10 Thread Alan Gauld
"louis leichtnam" wrote I'm trying to build a graphic interface, with button, radiobutton, enter text area etc. Does anyone have an idea or a source code for this? You could start with the GUI topic in my tutor and then progress to one of the more detailed tutorials on the web... And as a

Re: [Tutor] Problem with printing Python output to HTML Correctly

2011-05-10 Thread Spyros Charonis
A SOLUTION TO THE PROBLEM I POSTED: align_file_rmode = open('/Users/spyros/folder1/python/printsmotifs/alignfiles/' + query1, 'r') align_file_appmode = open('/Users/spyros/folder1/python/printsmotifs/alignfiles/' + query2, 'a+') finalmotifs = motif_file.readlines() seqalign = align_file_rmode.rea

Re: [Tutor] Problem with printing Python output to HTML Correctly

2011-05-10 Thread Stefan Behnel
Spyros Charonis, 10.05.2011 19:14: On Tue, May 10, 2011 at 5:11 PM, Spyros Charonis wrote: I know I posted the exact same topic a few hours ago and I do apologize for this, but my script had a careless error, and my real issue is somewhat different. I would have preferred an update to the init

Re: [Tutor] Problem with printing Python output to HTML Correctly

2011-05-10 Thread Spyros Charonis
Hi all, No need to post answers, I figured out where my mistake was. Spyros On Tue, May 10, 2011 at 5:11 PM, Spyros Charonis wrote: > Hello, > > I know I posted the exact same topic a few hours ago and I do apologize for > this, but my script had a careless error, and my real issue is somewhat

[Tutor] Problem with printing Python output to HTML Correctly

2011-05-10 Thread Spyros Charonis
Hello, I know I posted the exact same topic a few hours ago and I do apologize for this, but my script had a careless error, and my real issue is somewhat different. I have a Python script that extracts some text from a database file and annotates another file, writing the results to a new file.

Re: [Tutor] Printing output from Python program to HTML

2011-05-10 Thread Spyros Charonis
Thanks, very simple but I missed that because it was supposed be in HTML code! On Tue, May 10, 2011 at 1:16 PM, Spyros Charonis wrote: > Hello everyone, > > I have a Python script that extracts some text from a database file and > annotates another file, > writing the results to a new file. Becau

Re: [Tutor] Graphic interface

2011-05-10 Thread Rance Hall
On Tue, May 10, 2011 at 7:41 AM, louis leichtnam wrote: > Hello, > I'm trying to build a graphic interface, with button, radiobutton, enter > text area etc. > Does anyone have an idea or a source code for this? > Thank you, > Louis How you do this exactly depends on a number of things you don't s

Re: [Tutor] Graphic interface

2011-05-10 Thread Brett Ritter
On Tue, May 10, 2011 at 8:41 AM, louis leichtnam wrote: > I'm trying to build a graphic interface, with button, radiobutton, enter > text area etc. > Does anyone have an idea or a source code for this? Assuming that you're talking about a desktop application rather than a web-based application, I

Re: [Tutor] folder and file list

2011-05-10 Thread Brett Ritter
On Tue, May 10, 2011 at 8:17 AM, Tommy Bell wrote: > scandir('c:\tmp') > this doesnt work, I know why - but i dont know how to fix it. > The reason it doesnt work is because isfile requires a file, but current > contains a path. Not quite. Stick a "print path" as the first line in scandir. No

[Tutor] Graphic interface

2011-05-10 Thread louis leichtnam
Hello, I'm trying to build a graphic interface, with button, radiobutton, enter text area etc. Does anyone have an idea or a source code for this? Thank you, Louis ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options:

Re: [Tutor] Printing output from Python program to HTML

2011-05-10 Thread Steven D'Aprano
Spyros Charonis wrote: newline = line.replace(item, " item ") # compiler complains here about the word "red" You should pay attention when Python tells you where there is an error. If it says there is a syntax error, then your syntax is invalid and you need to fix it. The Pyth

Re: [Tutor] Printing output from Python program to HTML

2011-05-10 Thread Brett Ritter
On Tue, May 10, 2011 at 8:16 AM, Spyros Charonis wrote: >           newline = line.replace(item, " item ... > The Python compiler complains on the line I try to change the font color, > saying "invalid syntax". Your issue here is not importing libraries, but your quotations. When you get to "re

[Tutor] folder and file list

2011-05-10 Thread Tommy Bell
Hey, quite new at python and I have been trying to make a script that will list folders and files, but so far its not working import os, glob def scandir(path): direc = [] file = [] for current in glob.glob(os.path.join(path,'*')): if os.path.isdir(current): direc

[Tutor] Printing output from Python program to HTML

2011-05-10 Thread Spyros Charonis
Hello everyone, I have a Python script that extracts some text from a database file and annotates another file, writing the results to a new file. Because the files I am annotating are ASCII, I am very restricted as to how I can annotate the text, and I would like to instead write the results to H

Re: [Tutor] Dictionary File character reader

2011-05-10 Thread Dave Angel
On 01/-10/-28163 02:59 PM, Clara Mintz wrote: Sorry I am completely new at python and don't understand why this function is returning an empty dictionary. I want it to take a list of files open them then return the number of characters as the value and the file name as the key. def fileLengths

Re: [Tutor] Dictionary File character reader

2011-05-10 Thread Alan Gauld
"Noah Hall" wrote What you want is something that takes the length of each line, and add it to the sum. A simple way would be to do sum(len(line) for line in file) And if you just want the total count for the file an even simpler way is to use file.read() count = len(file.read()) One