Alan Gauld via Tutor wrote:
>>exec() might even be a way
>
> It's a way but it's a bad way! :-)
And then
> A simple approach you could use would be to get Python to
> generate a new python file(module) containing the required class
> definition (simple string processing) and then dynamically
>
On 07/11/2018 23:06, Alan Gauld via Tutor wrote:
>> Imagine having to write this for 100 columns, brrr.
>
> No problem, I've done that dozens of time for production C++ code,
> it's business as usual in commercial programming.
>
> Of course I'd get the data from a meta SQL query and feed it
On 07/11/2018 23:06, Alan Gauld via Tutor wrote:
> Another option would be to explore metaclasses
> and modify the class creation mechanism
Which, of course, is what you were doing with the type(...)
call in your post...
--
Alan G
Author of the Learn to Program web site
On 08Nov2018 10:00, Steven D'Aprano wrote:
Note that I need this to be platform agnostic.
That's hard, even on a single platform like Linux.
Most, nearly all, terminal honour carriage return and backspace. That is
technically enough. Even terminals with a destructive backspace (rare -
it
On 11/7/18 4:31 AM, srinivasan wrote:
> Even after changing as per the below
> "blkid -o export %s | grep 'TYPE' | cut -d'=' -f3"
> or:
> 'blkid -o export %s | grep "TYPE" | cut -d"=" -f3'
> or:
> "blkid -o export %s | grep \"TYPE\" | cut -d\"=\" -f3"
>
> Still my output is:
> */dev/mmcblk1p1:
On Wed, Nov 07, 2018 at 10:22:00AM +0100, srinivasan wrote:
> Could you please help me as it seems to be like grep and cut commands are
> not working in the above line ie., on *cmd = "blkid -o export %s | grep
> \'TYPE\' | cut -d\"=\" -f3" % fs*?
Then get them working first. What happens when
On 07/11/2018 20:07, Albert-Jan Roskam wrote:
> I should have mentioned that the code ... should be able to convert
> an *arbitrary* Sql server table into hdf5 format*).
Umm, yes that would have helped!
from tables import *
class Particle(IsDescription):
> ... name =
On Wed, Nov 07, 2018 at 11:22:22AM -0500, Chip Wachob wrote:
> Hello,
>
> I'm sure that this is simple and my searches have just not used the
> correct words.
>
> What I would like to do is display, on a single line, in the terminal
> / command line a progress percentage, or, simply a sequence
On Wed, 7 Nov 2018 at 18:35, Alan Gauld via Tutor wrote:
>
> On 07/11/2018 14:48, Albert-Jan Roskam wrote:
>
> > What is the best way to dynamically set class variables?
>
> I think I'm maybe missing the point of your question?
I think you are as well :)
IIUC then the question is: how can I
On Wed, Nov 07, 2018 at 02:48:40PM +, Albert-Jan Roskam wrote:
> What is the best way to dynamically set class variables? I am looking
> for a generalization of something like this:
>
> class Parent: pass
> class Child(Parent):
> col1 = 'str'
> col2 = 'int'
The obvious solution is
On 07Nov2018 11:22, Chip Wachob wrote:
I'm sure that this is simple and my searches have just not used the
correct words.
What I would like to do is display, on a single line, in the terminal
/ command line a progress percentage, or, simply a sequence of - / -
\, etc.. or even, accumulating
On 7 Nov 2018 20:36, Mats Wichmann wrote:
Not sure what you're after, but what's wrong with just setting them?
Parent.avar = "a class var"
Hi Alan, Mats,
I should have mentioned that the code is part of a function sql_to_hdf5. So it
should be able to convert an *arbitrary* Sql server table
Not sure what you're after, but what's wrong with just setting them?
Parent.avar = "a class var"
On November 7, 2018 7:48:40 AM MST, Albert-Jan Roskam
wrote:
>Hi,
>
>Background: In my code I use sqlalchemy to read SQL server data. I want
>to write that data to HDF5 using pytables (see
On 07/11/2018 11:31, srinivasan wrote:
> Even after changing as per the below
> "blkid -o export %s | grep 'TYPE' | cut -d'=' -f3"
> or:
> 'blkid -o export %s | grep "TYPE" | cut -d"=" -f3'
> or:
> "blkid -o export %s | grep \"TYPE\" | cut -d\"=\" -f3"
>
> Still my output is:
> */dev/mmcblk1p1:
On Wed, Nov 7, 2018 at 1:17 PM Alan Gauld via Tutor wrote:
> In Python 3 there are parameters to print()
>
> while someProcess():
>time.sleep(1)
>print('.', end='', sep='') # no newline and no spaces
You'll also want `flush=True` here to avoid having your dots buffered
until
On 07/11/2018 15:56, Asad wrote:
> Hi All,
>
> I tired seems its not working as required :
>
> from os.path import dirname, join
>
> testdir = dirname("/a/b/c/d/test/test_2814__2018_10_05_12_12_45/logA.log")
Note that this will set testdir to
On 07/11/2018 16:22, Chip Wachob wrote:
> What I would like to do is display, on a single line, in the terminal
> / command line a progress percentage, or, simply a sequence of - / -
> \, etc.. or even, accumulating period characters.
>
> What would the escape codes be, or is there a better way
I have an sqlite database as a source {Asset and Test data from a Megger
PAT Tester}, which contains a number of tables, and I end up with an
OpenOffice spreadsheet, with numerous sheets
The data is proceesed in three parts, each using a separate Class.
I extract the useful tables, and store
Hi All,
I tired seems its not working as required :
from os.path import dirname, join
testdir = dirname("/a/b/c/d/test/test_2814__2018_10_05_12_12_45/logA.log")
dirpath = join(testdir, '123456/789')
print dirpath
/a/b/c/d/test/test_2814__2018_10_05_12_12_45\123456/789
Instead i
Gmail: Click Compose (Upper Left corner)
Window opens. In lower right corner within the compose window, click
on the 3 stacked dots.
Select text only.
On Wed, Nov 7, 2018 at 1:39 AM Adam Eyring wrote:
>
> When I post code with questions, I just copy and paste from Python IDLE
> 3.6. Colors are
Hello,
I'm sure that this is simple and my searches have just not used the
correct words.
What I would like to do is display, on a single line, in the terminal
/ command line a progress percentage, or, simply a sequence of - / -
\, etc.. or even, accumulating period characters.
What would the
On Wed, 2018-11-07 at 10:22 +0100, srinivasan wrote:
> blkid -o export %s | grep \'TYPE\' | cut -d\"=\" -f3
You don't need to escape the single quotes.
Try either:
"blkid -o export %s | grep 'TYPE' | cut -d'=' -f3"
or:
'blkid -o export %s | grep "TYPE" | cut -d"=" -f3'
or:
"blkid -o export %s |
Even after changing as per the below
"blkid -o export %s | grep 'TYPE' | cut -d'=' -f3"
or:
'blkid -o export %s | grep "TYPE" | cut -d"=" -f3'
or:
"blkid -o export %s | grep \"TYPE\" | cut -d\"=\" -f3"
Still my output is:
*/dev/mmcblk1p1: LABEL="efi" UUID="1084-AA42" TYPE="vfat"*
My expected
After changing the line to *"cmd = "blkid -o export %s | grep \'TYPE\' |
cut -d\"=\" -f3" % fs"*, Now I dont see the error "SyntaxError: can't
assign to literal"
This is not returning exactly "*vfat*" instead of this, it is returning as "*
/dev/mmcblk1p1: LABEL="efi" UUID="1084-AA42" TYPE="vfat"*
On 07/11/2018 14:48, Albert-Jan Roskam wrote:
> What is the best way to dynamically set class variables?
Remember the golden rule of OOP is that objects(and classes)
should do it to themselves. Ideally the class variables
should be there to support some kind of class behaviour
and that
Hi,
Background: In my code I use sqlalchemy to read SQL server data. I want to
write that data to HDF5 using pytables (see 'declaring a column descriptor':
https://www.pytables.org/usersguide/tutorials.html). My question is not about
pytables or sqlalchemy per se, but I thought it would be
I may be missing something but it looks like the embedded double quotes may be
a problem in this:
cmd = "blkid -o export %s | grep 'TYPE' | cut -d"=" -f3" % ...
if you use single quotes as in:
cut -d"="
becomes
cut -d'='
or escape the double quotes with \" and so on ...
The above seems to
When I post code with questions, I just copy and paste from Python IDLE
3.6. Colors are removed, but indentation is preserved.
On Tue, Nov 6, 2018 at 6:59 PM Mats Wichmann wrote:
> On 11/6/18 4:36 PM, Joseph Gulizia wrote:
> > Funny using a text editorand showed indented in my browser.
28 matches
Mail list logo