Re: [Tutor] RE Embedding Python in C

2019-07-09 Thread Alan Gauld via Tutor
On 09/07/2019 15:13, Ibarra, Jesse wrote: Caveat: I'm no expert on embedding and indeed have only done it once using the examples in the docs. However, based on my general Python experience... > I then embedded the example using C/Python API: >

Re: [Tutor] RE Embedding Python in C

2019-07-09 Thread Ibarra, Jesse
Sorry for the duplicate threads but the forwarded message did not send the original email. I apologize for any inconvenience. The file are below. I am running CentOS7: [jibarra@redsky ~]$ uname -a Linux redsky.lanl.gov 3.10.0-957.21.2.el7.x86_64 #1 SMP Wed Jun 5 14:26:44 UTC 2019 x86_64 x86_64

Re: [Tutor] Re Module

2018-12-27 Thread Avi Gross
rhaps doing a little debugging. -Original Message- From: Tutor On Behalf Of Asad Sent: Thursday, December 27, 2018 10:10 AM To: tutor@python.org Subject: [Tutor] Re Module Hi All , I trying find a solution for my script , I have two files : file1 - I need a search a error sa

Re: [Tutor] Re Module

2018-12-27 Thread Steven D'Aprano
On Thu, Dec 27, 2018 at 08:40:12PM +0530, Asad wrote: > Hi All , > > I trying find a solution for my script , I have two files : > > file1 - I need a search a error say x if the error matches > > Look for the same error x in other file 2 > > Here is the code : > I have 10 different

Re: [Tutor] Re Module

2018-12-27 Thread Alan Gauld via Tutor
On 27/12/2018 15:10, Asad wrote: > file1 - I need a search a error say x if the error matches > > Look for the same error x in other file 2 > > Here is the code : > I have 10 different patterns therefore I used list comprehension and > compiling the pattern so I loop over and find the exact

[Tutor] Re Module

2018-12-27 Thread Asad
Hi All , I trying find a solution for my script , I have two files : file1 - I need a search a error say x if the error matches Look for the same error x in other file 2 Here is the code : I have 10 different patterns therefore I used list comprehension and compiling the pattern so I

Re: [Tutor] Re subprocess

2014-09-11 Thread jarod...@libero.it
Thanks for the suggestion and corrections. I don't put the else staement onf if log_file but now I realize my mistake I have 3 comand to do: step_1_out =[STAR --genomeDir /home/sbsuser/databases/Starhg19/GenomeDir/ -- runMode alignReads --readFilesIn %s %s --runThreadN 12 --readFilesCommand

[Tutor] Re subprocess

2014-09-10 Thread jarod...@libero.it
If I follow the exmple I have this type of error: File ./RNA_prova.py, line 73, in run for line in p1.stdout(): TypeError: 'NoneType' object is not callable This is the class I use: def run(cmd,pi): import subprocess import time import logging

Re: [Tutor] Re subprocess

2014-09-10 Thread Wolfgang Maier
On 09/10/2014 11:20 AM, jarod...@libero.it wrote: If I follow the exmple I have this type of error: File ./RNA_prova.py, line 73, in run for line in p1.stdout(): TypeError: 'NoneType' object is not callable You have at least two errors in your script below: This time you're not piping

Re: [Tutor] Re subprocess

2014-09-10 Thread Steven D'Aprano
On Wed, Sep 10, 2014 at 11:20:38AM +0200, jarod...@libero.it wrote: If I follow the exmple I have this type of error: File ./RNA_prova.py, line 73, in run for line in p1.stdout(): TypeError: 'NoneType' object is not callable Somehow you have p1.stdout set to None. You can confirm this by

Re: [Tutor] re module

2014-08-19 Thread Sunil Tech
Hey thanks Danny Yoo, Chris “Kwpolska” Warrick, D.V.N Sarma ​. I will take all your inputs. Thanks a lot.​ On Fri, Aug 15, 2014 at 3:32 AM, Danny Yoo d...@hashcollision.org wrote: On Thu, Aug 14, 2014 at 8:39 AM, D.V.N.Sarma డి.వి.ఎన్.శర్మ dvnsa...@gmail.com wrote: I tested it on IDLE. It

[Tutor] re module

2014-08-14 Thread Sunil Tech
Hi, I have string like stmt = 'pspan style=font-size: 11pt;span style=font-family: times new roman,times;Patient name:nbsp;Upadhyay Shyam/spanspan style=font-family: times new roman,times;nbsp;nbsp;br /Date of birth:nbsp;nbsp;nbsp;08/08/1988 br /Issue(s) to be

Re: [Tutor] re module

2014-08-14 Thread Chris “Kwpolska” Warrick
On 14 Aug 2014 15:58 Sunil Tech sunil.tech...@gmail.com wrote: Hi, I have string like stmt = 'pspan style=font-size: 11pt;span style=font-family: times new roman,times;Patient name:nbsp;Upadhyay Shyam/spanspan style=font-family: times new roman,times;nbsp;nbsp;br /Date of

Re: [Tutor] re module

2014-08-14 Thread D . V . N . Sarma డి . వి . ఎన్ . శర్మ
I tested it on IDLE. It works. regards, Sarma. On Thu, Aug 14, 2014 at 7:37 PM, Chris “Kwpolska” Warrick kwpol...@gmail.com wrote: On 14 Aug 2014 15:58 Sunil Tech sunil.tech...@gmail.com wrote: Hi, I have string like stmt = 'pspan style=font-size: 11pt;span style=font-family:

Re: [Tutor] re module

2014-08-14 Thread Albert-Jan Roskam
- On Thu, Aug 14, 2014 4:07 PM CEST Chris “Kwpolska” Warrick wrote: On 14 Aug 2014 15:58 Sunil Tech sunil.tech...@gmail.com wrote: Hi, I have string like stmt = 'pspan style=font-size: 11pt;span style=font-family: times new roman,times;Patient name: Upadhyay

Re: [Tutor] re module

2014-08-14 Thread Danny Yoo
On Thu, Aug 14, 2014 at 8:39 AM, D.V.N.Sarma డి.వి.ఎన్.శర్మ dvnsa...@gmail.com wrote: I tested it on IDLE. It works. Hi Sarma, Following up on this one. I'm pretty sure that: print re.search(span style=\(.*)\, stmt).group() is going to print something, but it almost certainly will not

Re: [Tutor] re module

2014-08-14 Thread Danny Yoo
Hi Sunil, Don't use regular expressions for this task. Use something that knows about HTML structure. As others have noted, the Beautiful Soup or lxml libraries are probably a much better choice here. There are good reasons to avoid regexp for the task you're trying to do. For example, your

Re: [Tutor] [Re:] I need help with the following question

2013-09-11 Thread Oscar Benjamin
I'm resending this to the list. Please reply to the tutor list rather than directly to me. Also please don't top-post. My answer is below. On 11 September 2013 10:47, Thabile Rampa thabilera...@gmail.com wrote: On Tue, Sep 10, 2013 at 11:57 AM, Oscar Benjamin oscar.j.benja...@gmail.com wrote:

Re: [Tutor] [Re:] I need help with the following question

2013-09-11 Thread Steven D'Aprano
On Wed, Sep 11, 2013 at 11:15:26AM +0100, Oscar Benjamin wrote: There is also the .format method. This was initially intended to replace % formatting but it was ultimately decided that removing % formatting was not necessary. Consequently there are now two ways of doing advanced string

[Tutor] [Re:] I need help with the following question

2013-09-10 Thread Thabile Rampa
On Aug 27, 2013, at 3:40 AM, isaac Eric wrote snip print For a circle of radius %s the area is %s % (radius,area) snip Question: What is the purpose of %s ? I will admit that this is homework for me. However, this is more for my log book and not for marks. According to my understanding, the

Re: [Tutor] [Re:] I need help with the following question

2013-09-10 Thread Oscar Benjamin
On 10 September 2013 08:58, Thabile Rampa thabilera...@gmail.com wrote: On Aug 27, 2013, at 3:40 AM, isaac Eric wrote snip print For a circle of radius %s the area is %s % (radius,area) snip Question: What is the purpose of %s ? I will admit that this is homework for me. However, this is

Re: [Tutor] [Re:] I need help with the following question

2013-09-10 Thread Alan Gauld
On 10/09/13 08:58, Thabile Rampa wrote: print For a circle of radius %s the area is %s % (radius,area) snip Question: What is the purpose of %s ? Oscar has answered your basic question but to add to his comments thee are other reasons for using the %s rather than str() or simply printing

Re: [Tutor] [Re:] I need help with the following question

2013-09-10 Thread Dave Angel
On 10/9/2013 03:58, Thabile Rampa wrote: div dir=ltrdivpreOn Aug 27, 2013, at 3:40 AM, isaac Eric wrotebrbrlt;snipgt; span class=gt; print quot;For a circle of radius %s the area is %squot; % (radius,area)/span lt;snipgt; span class=gt; Question: What is the purpose of %s ?/span/preI

Re: [Tutor] re module- puzzling results when matching money

2013-08-04 Thread Dominik George
Hi, not quite. The moral is to learn about greedy and non-greedy matching ;)! -nik Alex Kleider aklei...@sonic.net schrieb: On 2013-08-03 13:38, Dominik George wrote: Hi, b is defined as all non-word characters, so it is the complement oft w. w is [A-Za-z0-9_-], so b includes $ and thus

Re: [Tutor] re module- puzzling results when matching money

2013-08-04 Thread Alan Gauld
On 04/08/13 08:45, Alex Kleider wrote: sorry, my bad. I forgot to delete that backslash, I meant re.findall(r\be\b, d e f). Same with the other example. ..but the interesting thing is that the presence or absence of the spurious back slashes seems not to change the results. It wouldn't

Re: [Tutor] re module- puzzling results when matching money

2013-08-03 Thread Dominik George
Hi, \b is defined as all non-word characters, so it is the complement oft \w. \w is [A-Za-z0-9_-], so \b includes \$ and thus cuts off your sign group. -nik Alex Kleider aklei...@sonic.net schrieb: #!/usr/bin/env python I've been puzzling over the re module and have a couple of questions

[Tutor] re 33.116

2012-07-19 Thread Emile van Sebille
I found ~200k files in /var/log all but 227 look like: list_boxes.day.1.gz.1.gz.1.gz.3.gz.1.gz.1.gz.2.gz.1.gz.1.gz.2.gz.1.gz list_boxes.day.1.gz.1.gz.1.gz.3.gz.1.gz.1.gz.2.gz.1.gz.1.gz.2.gz.1.gz.1.gz list_boxes.day.1.gz.1.gz.1.gz.3.gz.1.gz.1.gz.2.gz.1.gz.1.gz.2.gz.1.gz.1.gz.1.gz

Re: [Tutor] re 33.116

2012-07-19 Thread Emile van Sebille
On 7/19/2012 4:10 PM Emile van Sebille said... I found ~200k files in /var/log all but 227 look like: Sorry -- my bad. Emile ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options:

[Tutor] re module help

2012-01-09 Thread Ganesh Kumar
Hi Gurus, I have created regular expression with os modules, I have created file sdptool to match the regular expression pattern, will print the result. I want without creating file how to get required output, I tried but i didn't get output correctly, over stream. #! /usr/bin/python import

Re: [Tutor] re module help

2012-01-09 Thread bodsda
@python.org Date: Mon, 9 Jan 2012 14:47:46 To: tutor@python.org Subject: [Tutor] re module help ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

[Tutor] Re : Python loop isn't working

2011-08-05 Thread kliat...@gmail.com
Can you try to split it into fonctions Because it is hard to read it. Envoyé depuis mon HTC - Reply message - De : Susana Iraiis Delgado Rodriguez susana.delgad...@utzmg.edu.mx Pour : tutor@python.org Objet : [Tutor] Python loop isnapos;t working Date : ven., août 5, 2011 18:14 Hello

Re: [Tutor] RE

2011-04-06 Thread Steve Willoughby
On 06-Apr-11 02:03, JOHN KELLY wrote: I need help. Can you be a little more specific? :) -- Steve Willoughby / st...@alchemy.com A ship in harbor is safe, but that is not what ships are built for. PGP Fingerprint 48A3 2621 E72C 31D9 2928 2E8F 6506 DB29 54F7 0F53

Re: [Tutor] RE

2011-04-06 Thread Michiel Overtoom
On 2011-04-06 11:03, JOHN KELLY wrote: I need help. In that case, start with http://wiki.python.org/moin/BeginnersGuide -- Lots of people have brilliant ideas every day, but they often disappear in the cacophony of life that we muddle through. - Evan Jenkins,

Re: [Tutor] RE module is working ?

2011-02-04 Thread Peter Otten
Karim wrote: Recall: re.subn(r'([^\\])?', r'\1\\', expression) Traceback (most recent call last): File stdin, line 1, inmodule File /home/karim/build/python/install/lib/python2.7/re.py, line 162, in subn return _compile(pattern, flags).subn(repl, string, count)

Re: [Tutor] RE module is working ?

2011-02-04 Thread Peter Otten
Karim wrote: That is not the thing I want. I want to escape any which are not already escaped. The sed regex '/\([^\\]\)\?/\1\\/g' is exactly what I need (I have made regex on unix since 15 years). Can the backslash be escaped, too? If so I don't think your regex does what you think it

Re: [Tutor] RE module is working ?

2011-02-04 Thread Karim
On 02/04/2011 02:36 AM, Steven D'Aprano wrote: Karim wrote: *Indeed what's the matter with RE module!?* You should really fix the problem with your email program first; Thunderbird issue with bold type (appears as stars) but I don't know how to fix it yet. A man when to a doctor and said,

Re: [Tutor] RE module is working ?

2011-02-03 Thread Karim
Hello, Any news on this topic?O:-) Regards Karim On 02/02/2011 08:21 PM, Karim wrote: Hello, I am trying to subsitute a '' pattern in '\\' namely escape 2 consecutives double quotes: * *In Python interpreter:* $ python Python 2.7.1rc1 (r271rc1:86455, Nov 16 2010, 21:53:40) [GCC

Re: [Tutor] RE module is working ?

2011-02-03 Thread Steven D'Aprano
Karim wrote: Hello, I am trying to subsitute a '' pattern in '\\' namely escape 2 consecutives double quotes: You don't have to escape quotes. Just use the other sort of quote: print '' * *In Python interpreter:* $ python Python 2.7.1rc1 (r271rc1:86455, Nov 16 2010, 21:53:40) [GCC

Re: [Tutor] RE module is working ?

2011-02-03 Thread Karim
Hello Steven, I am perhaps a poor tradesman but I have to blame my thunderbird tool :-P . Because expression = *' '* is in fact fact expression = ' '. The bold appear as stars I don't know why. I need to have escapes for passing it to another language (TCL interpreter). So I will rewrite

Re: [Tutor] RE module is working ?

2011-02-03 Thread Karim
I forget something. There is no issue with python and double quotes. But I need to give it to TCL script but as TCL is shit string is only delimited by double quotes. Thus I need to escape it to not have syntax error whith nested double quotes. Regards The poor tradesman On 02/03/2011

Re: [Tutor] RE module is working ?

2011-02-03 Thread Peter Otten
Karim wrote: I am trying to subsitute a '' pattern in '\\' namely escape 2 consecutives double quotes: * *In Python interpreter:* $ python Python 2.7.1rc1 (r271rc1:86455, Nov 16 2010, 21:53:40) [GCC 4.4.3] on linux2 Type help, copyright, credits or license for more information.

Re: [Tutor] RE module is working ?

2011-02-03 Thread Karim
On 02/03/2011 02:15 PM, Peter Otten wrote: Karim wrote: I am trying to subsitute a '' pattern in '\\' namely escape 2 consecutives double quotes: * *In Python interpreter:* $ python Python 2.7.1rc1 (r271rc1:86455, Nov 16 2010, 21:53:40) [GCC 4.4.3] on linux2 Type help, copyright,

Re: [Tutor] RE module is working ?

2011-02-03 Thread Dave Angel
On 01/-10/-28163 02:59 PM, Karim wrote: On 02/03/2011 02:15 PM, Peter Otten wrote: Karim wrote: (snip *Indeed what's the matter with RE module!?* You should really fix the problem with your email program first; Thunderbird issue with bold type (appears as stars) but I don't know how to fix

Re: [Tutor] RE module is working ?

2011-02-03 Thread Karim
On 02/03/2011 11:20 PM, Dave Angel wrote: On 01/-10/-28163 02:59 PM, Karim wrote: On 02/03/2011 02:15 PM, Peter Otten wrote: Karim wrote: (snip *Indeed what's the matter with RE module!?* You should really fix the problem with your email program first; Thunderbird issue with bold type

Re: [Tutor] RE module is working ?

2011-02-03 Thread Karim
On 02/03/2011 07:47 PM, Karim wrote: On 02/03/2011 02:15 PM, Peter Otten wrote: Karim wrote: I am trying to subsitute a '' pattern in '\\' namely escape 2 consecutives double quotes: * *In Python interpreter:* $ python Python 2.7.1rc1 (r271rc1:86455, Nov 16 2010, 21:53:40) [GCC 4.4.3]

Re: [Tutor] RE module is working ?

2011-02-03 Thread Alan Gauld
Karim karim.liat...@free.fr wrote Because expression = *' '* is in fact fact expression = ' '. The bold appear as stars I don't know why. Because in the days when email was always sent in plain ASCII text the way to show bold was to put asterisks around it. Underlining used

Re: [Tutor] RE module is working ?

2011-02-03 Thread Steven D'Aprano
Karim wrote: *Indeed what's the matter with RE module!?* You should really fix the problem with your email program first; Thunderbird issue with bold type (appears as stars) but I don't know how to fix it yet. A man when to a doctor and said, Doctor, every time I do this, it hurts. What

[Tutor] RE module is working ?

2011-02-02 Thread Karim
Hello, I am trying to subsitute a '' pattern in '\\' namely escape 2 consecutives double quotes: * *In Python interpreter:* $ python Python 2.7.1rc1 (r271rc1:86455, Nov 16 2010, 21:53:40) [GCC 4.4.3] on linux2 Type help, copyright, credits or license for more information. expression =

[Tutor] Re Problems with creating XML-documents

2010-04-15 Thread Karjer Jdfjdf
I'm having problems with creating XML-documents, because I don't seem to write it to a document correctly. Is that because you don't understand XML or because the output is not what you expect? How is the data being generated? Are you parsing an existing XML source or creating the XML from

Re: [Tutor] Re Problems with creating XML-documents

2010-04-15 Thread Lie Ryan
On 04/15/10 16:03, Karjer Jdfjdf wrote: When I try to parse the outputfile it creates different errors such as: * ExpatError: not well-formed (invalid token): That error message is telling you that you're not parsing an XML file, merely an XML-like file. Basically it ususally has something

Re: [Tutor] Re ading List from File

2009-11-11 Thread furblender
Hello everyone, I to had the same problem and it pestered me to the nth degree. I had that many problems I went to the python site and copied an example and used that to test why it wasn't working -see below example and traceback report. I wasted a lot of time trying to figure my issue out. Then

Re: [Tutor] Re ading List from File

2009-11-11 Thread Shashwat Anand
snip Samir-16 wrote: Hi Everyone, I am trying to read a comma-delimitted list (aaa,bbb,ccc) from a text file and assign those values to a list, x, such that: x = [aaa, bbb, ccc] The code that I have come up with looks like this: x = [] f = open(r'c:\test.txt', 'r')

[Tutor] re module / separator

2009-06-24 Thread Tiago Saboga
Hi! I am trying to split some lists out of a single text file, and I am having a hard time. I have reduced the problem to the following one: text = a2345b. f325. a45453b. a325643b. a435643b. g234324b. Of this line of text, I want to take out strings where all words start with a, end with b..

Re: [Tutor] re module / separator

2009-06-24 Thread Serdar Tumgoren
Hey Tiago, text = a2345b. f325. a45453b. a325643b. a435643b. g234324b. Of this line of text, I want to take out strings where all words start with a, end with b.. But I don't want a list of words. I want that: [a2345b., a45453b. a325643b. a435643b.] Are you saying you want a list of every

Re: [Tutor] re module / separator

2009-06-24 Thread Tiago Saboga
Serdar Tumgoren zstumgo...@gmail.com writes: Hey Tiago, text = a2345b. f325. a45453b. a325643b. a435643b. g234324b. Of this line of text, I want to take out strings where all words start with a, end with b.. But I don't want a list of words. I want that: [a2345b., a45453b. a325643b.

Re: [Tutor] re module / separator

2009-06-24 Thread Kent Johnson
On Wed, Jun 24, 2009 at 2:24 PM, Tiago Sabogatiagosab...@gmail.com wrote: Hi! I am trying to split some lists out of a single text file, and I am having a hard time. I have reduced the problem to the following one: text = a2345b. f325. a45453b. a325643b. a435643b. g234324b. Of this line of

Re: [Tutor] re module / separator

2009-06-24 Thread Serdar Tumgoren
As usual, Kent Johnson has swooped in an untangled the mess with a clear explanation. By the time a regex gets this complicated, I typically start thinking of ways to simplify or avoid them altogether. Below is the code I came up with. It goes through some gymnastics and can surely stand

Re: [Tutor] re module / separator

2009-06-24 Thread Serdar Tumgoren
Ok -- realized my solution incorrectly strips white space from multiword strings: Out[92]: ['a2345b.', 'a45453b.a325643b.a435643b.'] So here are some more gymnastics to get the correct result: In [105]: newlist Out[105]: ['a2345b.', '|', 'a45453b.', 'a325643b.', 'a435643b.', '|'] In [109]:

[Tutor] re Format a file

2009-02-28 Thread prasad rao
Hello for line in so: if len(line)70:de.write(line+'\n') if len(line)70: da=textwrap.fill(line,width=60) de.write(da+'\n') What happens if the line is exactly 70 characters long? I think you want an else instead of the second if Alan G

[Tutor] re Format a file

2009-02-27 Thread prasad rao
HelloFinally I managed to writ a function to format a file. Thank to everybody for their tips. def mmm(a): import os,textwrap so=open(a) d=os.path.dirname(a)+os.sep+'temp.txt' de=open(d,'w') import textwrap for line in so: if

Re: [Tutor] re Format a file

2009-02-27 Thread Alan Gauld
prasad rao prasadarao...@gmail.com wrote for line in so: if len(line)70:de.write(line+'\n') if len(line)70: da=textwrap.fill(line,width=60) de.write(da+'\n') What happens if the line is exactly 70 characters long? I think you want an else

Re: [Tutor] re Format a file

2009-02-27 Thread Kent Johnson
On Fri, Feb 27, 2009 at 5:09 AM, prasad rao prasadarao...@gmail.com wrote: Hello Finally I  managed to writ a function to format a file. Thank to everybody for their tips. def mmm(a): import os,textwrap so=open(a) d=os.path.dirname(a)+os.sep+'temp.txt' de=open(d,'w')

[Tutor] re Format a file

2009-02-26 Thread prasad rao
HelloI don't know why, but this I think going into infinite loop. I cant see anything wrong in it. Please show me where the problem is. def myform(s): import os so=open(s) d=os.path.dirname(s)+os.sep+'temp.txt' de=open(d,'w') for line in so: while len(line)60:

Re: [Tutor] re Format a file

2009-02-26 Thread John Fouhy
2009/2/27 prasad rao prasadarao...@gmail.com: Hello I don't know why, but this I think going into infinite loop. I cant see anything wrong in it. Please show me where  the problem is. [...] while len(line)60: tem=line[60:] try: ??? 

Re: [Tutor] re Format a file

2009-02-26 Thread Lie Ryan
On Fri, 27 Feb 2009 09:59:40 +0530, prasad rao wrote: def myform(s): import os so=open(s) d=os.path.dirname(s)+os.sep+'temp.txt' de=open(d,'w') for line in so: while len(line)60: item=line[60:] try:

Re: [Tutor] re Formating

2009-02-25 Thread Kent Johnson
On Wed, Feb 25, 2009 at 7:46 AM, prasad rao prasadarao...@gmail.com wrote: hi licenseRe = re.compile(r'\(([A-Z]+)\)\s*(No.\d+)?') for license in licenses:       m = licenseRe.search(license)       print m.group(1, 3) Traceback (most recent call last):   File pyshell#17, line 3, in module  

[Tutor] re Binding Event

2009-02-10 Thread prasad rao
HelloI changed the code as follows.But still the callback function is not working. The he() is working well but clicking on the frame has no result. class app: def __init__(self,root): frame=Frame(root) frame.bind(Button-1, callback) frame.pack()

Re: [Tutor] re Binding Event

2009-02-10 Thread Alan Gauld
prasad rao prasadarao...@gmail.com wrote HelloI changed the code as follows.But still the callback function is not working. The he() is working well but clicking on the frame has no result. class app: def __init__(self,root): frame=Frame(root) frame.bind(Button-1, callback) Should this

[Tutor] re division problem

2009-02-04 Thread prasad rao
hi I modified my function ' vertical' by adding a few characters to eliminate the division problem. def vertical(columns): if columns7: columns=7 import string v=string.printable v=v.replace('\n','') v=v.replace('\t','') if len(v)%columns !=0:

[Tutor] re division problem

2009-02-03 Thread prasad rao
I wrote a function named vertical to print string .printable characters and . ASCII values in a table. 1)It is swallowing some characters. 2)It output some characters 2 or 3 times. 3)It prints one column more than what I asked for. def vertical(columns): import string

[Tutor] re weird bool

2009-02-03 Thread prasad rao
helloyes.you are right. 2==True False It is an unexpected result to me. I thought any value other than 0 is True. And the solution provided by you(bool(a/1)) is useful to me. Thank you Prasad ___ Tutor maillist - Tutor@python.org

Re: [Tutor] re division problem

2009-02-03 Thread Andre Engels
On Tue, Feb 3, 2009 at 2:46 PM, prasad rao prasadarao...@gmail.com wrote: hi Right now you skip by x+((len(v))/columns) which will be different for each row. How is it possible. len(v)=98.A constant. Is it not. Does len(v) changes with each iteration? No, but x does. -- André Engels,

Re: [Tutor] re division problem

2009-02-03 Thread Kent Johnson
On Tue, Feb 3, 2009 at 8:24 AM, prasad rao prasadarao...@gmail.com wrote: I wrote a function named vertical to print string .printable characters and . ASCII values in a table. 1)It is swallowing some characters. 2)It output some characters 2 or 3 times. 3)It prints one column more than

[Tutor] re division problem

2009-02-03 Thread prasad rao
hiRight now you skip by x+((len(v))/columns) which will be different for each row. How is it possible. len(v)=98.A constant. Is it not. Does len(v) changes with each iteration? Prasad ___ Tutor maillist - Tutor@python.org

Re: [Tutor] re weird bool

2009-02-03 Thread Alan Gauld
prasad rao prasadarao...@gmail.com wrote 2==True False It is an unexpected result to me. I thought any value other than 0 is True. Any value of non zero is treated as True in a boolean context. But aq test of equality with a boolean value is not a boolean context. For equiality you have to

Re: [Tutor] Re : Is instance of what?

2009-02-01 Thread spir
Le Sat, 31 Jan 2009 15:00:02 -0500, Kent Johnson ken...@tds.net a écrit : On Sat, Jan 31, 2009 at 2:47 PM, spir denis.s...@free.fr wrote: o.__class__ (or rather o.__class__.__name__) will work. Understood. Thank you. tj type(a) has been changed (since 2.2?) to return the same value

[Tutor] Re : Is instance of what?

2009-01-31 Thread Andre Engels
On Sat, Jan 31, 2009 at 5:57 PM, Tim Johnson t...@johnsons-web.com wrote: Using python 2.5.1 If I create a class a class a: pass initialize o as: o=a and call isinstance(o,a) the return value is True. Actually, it is false. To make it true, you have to do o=a() rather than o=a

Re: [Tutor] Re : Is instance of what?

2009-01-31 Thread Tim Johnson
On Saturday 31 January 2009, Andre Engels wrote: ... o=a Actually, it is false. To make it true, you have to do o=a() rather than o=a You're correct. That was my typo. Is there a function that takes one argument and returns the class? Example: class = whatclass(o) ...

Re: [Tutor] Re : Is instance of what?

2009-01-31 Thread spir
Le Sat, 31 Jan 2009 09:54:24 -0900, Tim Johnson t...@johnsons-web.com a écrit : On Saturday 31 January 2009, Andre Engels wrote: ... o=a Actually, it is false. To make it true, you have to do o=a() rather than o=a You're correct. That was my typo. Is there a function that

Re: [Tutor] Re : Is instance of what?

2009-01-31 Thread Kent Johnson
On Sat, Jan 31, 2009 at 2:47 PM, spir denis.s...@free.fr wrote: o.__class__ (or rather o.__class__.__name__) will work. Understood. Thank you. tj type(a) has been changed (since 2.2?) to return the same value as a.__class__ I think you mean type(o) (type of the instance) rather than

[Tutor] re

2009-01-07 Thread prasad rao
Hello I am trying to get a value as integer and a string. class Value: def __init__(self,inte='',stri=''): self.inte=inte self.stri=stri def setvalue(self,inte='',stri=''): self.stri=str(self.inte) self.inte=int(self.stri) v=Value(45) print

Re: [Tutor] re

2009-01-07 Thread Andre Engels
On Wed, Jan 7, 2009 at 10:57 AM, prasad rao prasadarao...@gmail.com wrote: Hello I am trying to get a value as integer and a string. class Value: def __init__(self,inte='',stri=''): self.inte=inte self.stri=stri def setvalue(self,inte='',stri=''):

Re: [Tutor] RE Silliness

2009-01-05 Thread bob gailer
Omer wrote: Bob, I tried your way. import re urlMask = rhttp://[\w\Q./\?=\R]+(br)? text=uNot working examplebrhttp://this.is.a/url?header=nullbrAnd another linebrhttp://and.another.url; re.findall(urlMask,text) [u'br', u''] Oops I failed to notice you were using findall. Kent explained

Re: [Tutor] RE Silliness

2009-01-05 Thread Omer
Bob, I tried your way. import re urlMask = rhttp://[\w\Q./\?=\R]+(br)? text=uNot working examplebrhttp://this.is.a/url?header=nullbrAnd another linebrhttp://and.another.url; re.findall(urlMask,text) [u'br', u''] spir, I did understand it. What I'm not understanding is why isn't this working.

[Tutor] RE Silliness

2009-01-04 Thread Omer
I'm sorry, burrowed into the reference until my eyes bled. What I want is to have a regular expression with an optional ending of br (For those interested, urlMask = rhttp://[\w\Q./\?=\R]+; is ther version w/o the optional br ending.) I can't seem to make a string optional- only a single

Re: [Tutor] RE Silliness

2009-01-04 Thread spir
On Sun, 04 Jan 2009 14:09:53 -0500 bob gailer bgai...@gmail.com wrote: Omer wrote: I'm sorry, burrowed into the reference until my eyes bled. What I want is to have a regular expression with an optional ending of br (For those interested, urlMask = rhttp://[\w\Q./\?=\R]+; is

Re: [Tutor] [Re: class/type methods/functions]

2008-11-23 Thread Eike Welk
Hey Spir! Maybe you should read the book Design Patterns from Erich Gamma and the rest of the gang of four. (A.T.Hofkamp, mentioning its terminology, got me thinking.) You ask complicated questions that normal newbies don't ask, so you should maybe read an advanced book. The book's idea is:

Re: [Tutor] [Re: class/type methods/functions]

2008-11-01 Thread spir
Thank you for this relevant precise review, Albert. I will answer specific topic, then give a overall introduction of the problem(s) adressed by this project, that may clarify a bit some topics. this is quite a long post A.T.Hofkamp a écrit : However, by moving the 'type' information to a

[Tutor] [Re: class/type methods/functions]

2008-10-30 Thread spir
[forwarded, only A.T.Hofkamp got this answer] A.T.Hofkamp a écrit : spir wrote: Q: Is there a way to write /type/ (class) functions, meaning methods not bound to an instance, in python? As Bob Gailer already said, staticmethod seems to do what you want. Thank you for you answers about

[Tutor] RE expressions

2008-08-15 Thread Johan Nilsson
Hi all python experts I am trying to work with BeautifulSoup and re and running into one problem. What I want to do is open a webpage and get some information. This is working fine I then want to follow some of links on this page and proces them. I manage to get links that I am interested

Re: [Tutor] RE expressions

2008-08-15 Thread Steve Willoughby
Johan Nilsson wrote: 'text http:\123\interesting_adress\etc\etc\ more text' Does this really use backslashes in the text? The standard for URLs (if that's what it is) is to use forward slashes. For your RE, though, you can always use [...] to specify a range including whatever you like.

Re: [Tutor] RE expressions

2008-08-15 Thread Steve Willoughby
Steve Willoughby wrote: Johan Nilsson wrote: In [74]: p.findall('asdsa123abc\123jggfds') Out[74]: ['123abcS'] By the way, you're confusing the use of \ in strings in general with the use of \ in regular expressions and the appearance of \ as a character in data strings encountered by your

[Tutor] re adlines, read, and my own get_contents()

2008-06-19 Thread John [H2O]
I've defined: def get_contents(infile=file_object): return a list of lines from a file contents=infile.read() contents = contents.strip().split('\n') return contents then there's also: file_object.read() and file_object.readlines() and file_object.readline() I think I

Re: [Tutor] re adlines, read, and my own get_contents()

2008-06-19 Thread Kent Johnson
On Thu, Jun 19, 2008 at 2:44 AM, John [H2O] [EMAIL PROTECTED] wrote: I've defined: def get_contents(infile=file_object): return a list of lines from a file contents=infile.read() contents = contents.strip().split('\n') return contents I think I understand the differences, but

[Tutor] Re Open a directory in the default file manager

2008-05-20 Thread Tony Cappellini
Message: 2 Date: Thu, 15 May 2008 20:10:05 +0200 From: Tim Michelsen [EMAIL PROTECTED] Subject: [Tutor] Open a directory in the default file manager To: tutor@python.org Message-ID: [EMAIL PROTECTED] Content-Type: text/plain; charset=ISO-8859-15; format=flowed Hello, is there any function/module

[Tutor] RE: Debug C library in python program ‏(canceled )

2008-04-28 Thread tuyun
Sorry for this duplicated post, it's my mistake, plz ignore it Sorry From: [EMAIL PROTECTED]: [EMAIL PROTECTED]: Debug C library in python program‏Date: Tue, 29 Apr 2008 01:24:44 + HiMay be this is a basic question, but I havent find answer through google :(I'm not familiar with

[Tutor] Re: glade integration

2008-04-07 Thread tannhauser
On Mon, 07.04, 09:48, Luke Paireepinart wrote: Michael Miesner wrote: Hi- I am totally new to python and I cant figure out how to integrate a glade file into a python file. Is it as simple as referencing the glade file, or must the XML code from the glade file be copied in? Sorry to

[Tutor] Re: glade integration

2008-04-07 Thread tannhauser
http://gazpacho.sicem.biz/ has a build for windows. th ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] re-initialising shells

2007-12-21 Thread Alan Gauld
Jim Morcombe [EMAIL PROTECTED] wrote I have changed qwerty and saved it away. I have then run my program (F5) and the program acts as if it is using an old version of qwerty. You need to reload the module to pick up the changes. help(reload) Help on built-in function reload in module

[Tutor] re-initialising shells

2007-12-20 Thread Jim Morcombe
I have had a couple of strange cases I don't understand. I am using IDLE on Windows My program imports some stuff from another file using the statement from qwerty import * I have changed qwerty and saved it away. I have then run my program (F5) and the program acts as if it is using an old

  1   2   3   4   5   >