Re: How do I list only the methods I define in a class?

2018-06-01 Thread bruceg113355
On Thursday, May 31, 2018 at 10:18:53 PM UTC-4, bob gailer wrote: > On 5/31/2018 3:49 PM, bruceg113...@gmail.com wrote: > > How do I list only the methods I define in a class? > Here's a class with some method, defined in various ways: > > >>> class x(): > ... a=3 > ... def f():pass > ..

How do I list only the methods I define in a class?

2018-05-31 Thread bruceg113355
How do I list only the methods I define in a class? For example: class Produce(): def __init__ (self): print (dir (Produce)) def apples(self): pass def peaches(self): pass def pumpkin (self): pass The print (dir(Produce)) statement d

convert a string to a variable

2018-05-24 Thread bruceg113355
I am trying to convert a string to a variable. I got cases 1 & 2 to work, but not cases 3 & 4. The print statement in cases 3 & 4 reports the following: builtins.AttributeError: type object 'animal' has no attribute 'tiger' I am stuck on creating variables that can be accessed as follows

Re: best way to remove leading zeros from a tuple like string

2018-05-20 Thread bruceg113355
On Sunday, May 20, 2018 at 5:32:32 PM UTC-4, Paul wrote: > > > > > > This works for me: mytuplestring.replace("0","") > > > > Your regex will also eliminate non-leading zeros. Your right, what was I thinking? -- https://mail.python.org/mailman/listinfo/python-list

Re: best way to remove leading zeros from a tuple like string

2018-05-20 Thread bruceg113355
On Sunday, May 20, 2018 at 5:01:08 PM UTC-4, Michael F. Stemper wrote: > On 2018-05-20 14:54, bruceg113...@gmail.com wrote: > > Lets say I have the following tuple like string. > >(128, 020, 008, 255) > > > > What is the best way to to remove leading zeroes and end up with the > > following.

best way to remove leading zeros from a tuple like string

2018-05-20 Thread bruceg113355
Lets say I have the following tuple like string. (128, 020, 008, 255) What is the best way to to remove leading zeroes and end up with the following. (128, 20, 8, 255)-- I do not care about spaces This is the solution I came up with s = "(128, 020, 008, 255)" v = s.replace ("(

Re: Fastest way to remove the first x characters from a very long string

2015-05-16 Thread bruceg113355
On Saturday, May 16, 2015 at 12:59:19 PM UTC-4, Chris Angelico wrote: > On Sun, May 17, 2015 at 2:22 AM, wrote: > > # Original Approach > > # - > > ss = ss.split("\n") > > ss1 = "" > > for sdata in ss: > > ss1 = ss1 + (sdata[OFFSET:] + "\n") > > > > > > # Chris's Approach > >

Re: Fastest way to remove the first x characters from a very long string

2015-05-16 Thread bruceg113355
On Saturday, May 16, 2015 at 11:13:45 AM UTC-4, Rustom Mody wrote: > On Saturday, May 16, 2015 at 8:30:02 PM UTC+5:30, Grant Edwards wrote: > > On 2015-05-16, bruceg113355 wrote: > > > > > I have a string that contains 10 million characters. > > >

Re: Fastest way to remove the first x characters from a very long string

2015-05-16 Thread bruceg113355
On Saturday, May 16, 2015 at 10:06:31 AM UTC-4, Stefan Ram wrote: > bruceg113...@gmail.com writes: > >Your approach using .join is what I was looking for. > > I'd appreciate a report of your measurements. # Original Approach # - ss = ss.split("\n") ss1 = "" for sdata in ss:

Re: Fastest way to remove the first x characters from a very long string

2015-05-16 Thread bruceg113355
On Saturday, May 16, 2015 at 9:46:17 AM UTC-4, Chris Angelico wrote: > On Sat, May 16, 2015 at 11:28 PM, wrote: > > I have a string that contains 10 million characters. > > > > The string is formatted as: > > > > "001 : some hexadecimal text ... \n > > 002 : some hexadecimal text ... \n >

Fastest way to remove the first x characters from a very long string

2015-05-16 Thread bruceg113355
I have a string that contains 10 million characters. The string is formatted as: "001 : some hexadecimal text ... \n 002 : some hexadecimal text ... \n 003 : some hexadecimal text ... \n ... 010 : some hexadecimal text ... \n 011 : some hexadecimal text ... \n" and I need the

Re: Is there a simpler way to modify all arguments in a function before using the arguments?

2012-11-16 Thread bruceg113355
On Thursday, November 15, 2012 11:16:08 PM UTC-5, Ethan Furman wrote: > Emile van Sebille wrote: > > > > > > >> Using a decorator works when named arguments are not used. When named > > >> arguments are used, unexpected keyword error is reported. Is there a > > >> simple fix? > > > > > >

Re: Is there a simpler way to modify all arguments in a function before using the arguments?

2012-11-10 Thread bruceg113355
All, I never used decorators before. I saw Miki Tebeka's sample code and your rationale (Aahz) and I like it. For my application problem, decorators seem like a good solution. Thanks to all, Bruce On Saturday, November 10, 2012 10:35:12 AM UTC-5, Aahz wrote: > In article , > > Peter Otten

Re: Is there a simpler way to modify all arguments in a function before using the arguments?

2012-11-10 Thread bruceg113355
On Friday, November 9, 2012 8:16:12 PM UTC-5, Steven D'Aprano wrote: > On Fri, 09 Nov 2012 20:05:26 -0500, Roy Smith wrote: > > > > > In article <18134e77-9b02-4aec-afb0-794ed900d...@googlegroups.com>, > > > bruceg113...@gmail.com wrote: > > > > > >> Is there a simpler way to modify all arg

Is there a simpler way to modify all arguments in a function before using the arguments?

2012-11-09 Thread bruceg113355
Is there a simpler way to modify all arguments in a function before using the arguments? For example, can the below code, in the modify arguments section be made into a few statements? def someComputation (aa, bb, cc, dd, ee, ff, gg, hh): # modify arguments # ---

Need to archive a MySQL database using a python script

2012-09-25 Thread bruceg113355
Python Users Group, I need to archive a MySQL database using a python script. I found a good example at: https://gist.github.com/3175221 The following line executes however, the archive file is empty. os.popen("mysqldump -u %s -p%s -h %s -e --opt -c %s | gzip -c > %s.gz" % (user,p

Re: Python 2.6 and Sqlite3 - Slow

2012-08-28 Thread bruceg113355
On Tuesday, August 28, 2012 4:27:48 AM UTC-4, Cameron Simpson wrote: > On 27Aug2012 13:41, bruceg113...@gmail.com wrote: > > | When using the database on my C Drive, Sqlite performance is great! (<1S) > > | When using the database on a network, Sqlite performance is terrible! (17S) > > > >

Re: Python 2.6 and Sqlite3 - Slow

2012-08-27 Thread bruceg113355
On Monday, August 27, 2012 10:32:47 PM UTC-4, Bryan wrote: > bruceg113 wrote: > > > I selected sqlite for the following reasons: > > > > > > 1) Ships with Python. > > > 2) Familiar with Python. > > > 3) The Sqlite description athttp://www.sqlite.org/whentouse.htmlappears to > > meet my requir

Re: Python 2.6 and Sqlite3 - Slow

2012-08-27 Thread bruceg113355
Demian, I am not a database expert! I selected sqlite for the following reasons: 1) Ships with Python. 2) Familiar with Python. 3) The Sqlite description at http://www.sqlite.org/whentouse.html appears to meet my requirements: Very low volume and concurrency, small datasets, simple to use.

Re: Python 2.6 and Sqlite3 - Slow

2012-08-27 Thread bruceg113355
Uli, Answers to your questions: 1) There are approx 65 records and each record is 68 bytes in length. 2) Not applicable because number of records is fixed. 3) Takes less than a second to read all 65 records when all is well. Takes 17 seconds to read all 65 records when all is NOT WELL 4) Perfor

Python 2.6 and Sqlite3 - Slow

2012-08-26 Thread bruceg113355
My program uses Python 2.6 and Sqlite3 and connects to a network database 100 miles away. My program reads approx 60 records (4000 bytes) from a Sqlite database in less than a second. Each time the user requests data, my program can continuously read 60 records in less than a second. However

Re: Is there a clever way to pass arguments

2012-08-08 Thread bruceg113355
On Wednesday, August 8, 2012 9:07:04 PM UTC-4, Dave Angel wrote: > On 08/08/2012 08:41 PM, bruceg113...@gmail.com wrote: > > > Is there a way in Python to pass arguments without listing each argument? > > > For example, my program does the following: > > > > > > testData (z[0], z[1], z[2],

Is there a clever way to pass arguments

2012-08-08 Thread bruceg113355
Is there a way in Python to pass arguments without listing each argument? For example, my program does the following: testData (z[0], z[1], z[2], z[3], z[4], z[5], z[6], z[7]) Is there a clever way to pass arguments in a single statement knowing that each argument is a sequential index from

Re: Python and Outlook, sendinf an image in the body of email

2012-07-23 Thread bruceg113355
This assignment works: import win32com.client oOutlook = win32com.client.Dispatch("Outlook.Application") appt = oOutlook.CreateItem(0) appt.BodyFormat = win32com.client.constants.olFormatHTML But this assignment does not work: import win32com.client oOutlook = win32com.client.Dispatc

Re: Python and Outlook, sendinf an image in the body of email

2012-07-23 Thread bruceg113355
These do not work: appt.BodyFormat = olBodyFormat.olFormatHTML ... appt.BodyFormat = olBodyFormat.olFormatHTML NameError: name 'olBodyFormat' is not defined appt.BodyFormat = win32com.client.constants.olFormatHTML ... appt.BodyFormat = win32com.client.constan

Python and Outlook, sendinf an image in the body of email

2012-07-23 Thread bruceg113355
All, I am trying to figure out how to send a image in the body of a email when Making a Meeting Request. Below is my current code. Thanks, Bruce # code below is mainly from http://harunprasad.blogspot.com/2012/01/python-make-meeting-request-appointment.html #