Am 08.06.22 um 19:57 schrieb De ongekruisigde:
On 2022-06-08, 2qdxy4rzwzuui...@potatochowder.com
<2qdxy4rzwzuui...@potatochowder.com> wrote:
On 2022-06-09 at 04:15:46 +1000,
Chris Angelico wrote:
If you insist:
>>> s = 'nm-iodine:x:996:57::/var/empty:/run/current-system/sw/bin/nologin'
Am 09.06.22 um 07:50 schrieb Dave:
Hi,
I’ve found you also need to take care of multiple disk CD releases. These have
a format of
“1-01 Track Name”
“2-02 Trackl Name"
Meaning Disk 1 Track1, Disk 2, Track 2.
Also A and B Sides (from Vinyl LPs)
“A1-Track Name”
“B2-Track Name”
Side A, Track
2022 2:50 am
Subject: Re: How to test characters of a string
Hi,
I’ve found you also need to take care of multiple disk CD releases. These have
a format of
“1-01 Track Name”
“2-02 Trackl Name"
Meaning Disk 1 Track1, Disk 2, Track 2.
Also A and B Sides (from Vinyl LPs)
“A1-Track Name”
“B
Hi,
I’ve found you also need to take care of multiple disk CD releases. These have
a format of
“1-01 Track Name”
“2-02 Trackl Name"
Meaning Disk 1 Track1, Disk 2, Track 2.
Also A and B Sides (from Vinyl LPs)
“A1-Track Name”
“B2-Track Name”
Side A, Track 1, etc.
Cheers
Dave
> On 8 Jun 202
On 2022-06-08, 2qdxy4rzwzuui...@potatochowder.com
<2qdxy4rzwzuui...@potatochowder.com> wrote:
> On 2022-06-09 at 04:15:46 +1000,
> Chris Angelico wrote:
>
>> On Thu, 9 Jun 2022 at 04:14, <2qdxy4rzwzuui...@potatochowder.com> wrote:
>> >
>> > On 2022-06-09 at 03:18:56 +1000,
>> > Chris Angelico wr
On Wed, 8 Jun 2022 01:53:26 + (UTC), Avi Gross
declaimed the following:
>
>So is it necessary to insist on an exact pattern of two digits followed by a
>space?
>
>
>That would fail on "44 Minutes", "40 Oz. Dream", "50 Mission Cap", "50 Ways to
>Say Goodbye", "99 Ways to Die"
>
>It looks
On 2022-06-08, 2qdxy4rzwzuui...@potatochowder.com
<2qdxy4rzwzuui...@potatochowder.com> wrote:
> On 2022-06-08 at 08:07:40 -,
> De ongekruisigde wrote:
>
>> Depending on the problem a regular expression may be the much simpler
>> solution. I love them for e.g. text parsing and use them all the
On 2022-06-09 at 04:15:46 +1000,
Chris Angelico wrote:
> On Thu, 9 Jun 2022 at 04:14, <2qdxy4rzwzuui...@potatochowder.com> wrote:
> >
> > On 2022-06-09 at 03:18:56 +1000,
> > Chris Angelico wrote:
> >
> > > On Thu, 9 Jun 2022 at 03:15, <2qdxy4rzwzuui...@potatochowder.com> wrote:
> > > >
> > > >
On Thu, 9 Jun 2022 at 04:14, <2qdxy4rzwzuui...@potatochowder.com> wrote:
>
> On 2022-06-09 at 03:18:56 +1000,
> Chris Angelico wrote:
>
> > On Thu, 9 Jun 2022 at 03:15, <2qdxy4rzwzuui...@potatochowder.com> wrote:
> > >
> > > On 2022-06-08 at 08:07:40 -,
> > > De ongekruisigde wrote:
> > >
> >
On 2022-06-09 at 03:18:56 +1000,
Chris Angelico wrote:
> On Thu, 9 Jun 2022 at 03:15, <2qdxy4rzwzuui...@potatochowder.com> wrote:
> >
> > On 2022-06-08 at 08:07:40 -,
> > De ongekruisigde wrote:
> >
> > > Depending on the problem a regular expression may be the much simpler
> > > solution. I
On Thu, 9 Jun 2022 at 03:15, <2qdxy4rzwzuui...@potatochowder.com> wrote:
>
> On 2022-06-08 at 08:07:40 -,
> De ongekruisigde wrote:
>
> > Depending on the problem a regular expression may be the much simpler
> > solution. I love them for e.g. text parsing and use them all the time.
> > Unrival
On 2022-06-08 at 08:07:40 -,
De ongekruisigde wrote:
> Depending on the problem a regular expression may be the much simpler
> solution. I love them for e.g. text parsing and use them all the time.
> Unrivaled when e.g. parts of text have to be extracted, e.g. from lines
> like these:
>
>
> On 7 Jun 2022, at 23:24, Dave wrote:
>
> Yes, it was probably just a typeo on my part.
>
> I’ve now fixed the majority of cases but still got two strings that look
> identical but fail to match, this time (again by 10cc), “I’m Mandy Fly Me”.
>
> I’m putting money on it being a utf8 problem
On 2022-06-08, Christian Gollwitzer wrote:
> Am 07.06.22 um 23:01 schrieb Christian Gollwitzer:
>
>>> In [3]: re.sub(r'^\d+\s*', '', s) Out[3]: 'Trinket'
>>>
>
> that RE does match what you intended to do, but not exactly what you
> wrote in the OP. that would be '^\d\d.' start with exactly two
On 2022-06-08, Dave wrote:
> I hate regEx and avoid it whenever possible, I’ve never found something that
> was impossible to do without it.
I love regular expressions and use them where appropriate. Saves tons of
code and is often much more readable than the pages of code required to
do the sam
On 2022-06-08, dn wrote:
> On 08/06/2022 10.18, De ongekruisigde wrote:
>> On 2022-06-08, Christian Gollwitzer wrote:
>>> Am 07.06.22 um 21:56 schrieb Dave:
It depends on the language I’m using, in Objective C, I’d use isNumeric,
just wanted to know what the equivalent is in Python.
>>
the original (perhaps with some normalization of case and whitespace, fine. If
not will they match if one or both have something to remove as a prefix such as
"02 ". And if you are comparing items where the same song is in two different
numeric sequences on different disks, ...
On 2022-06-07 23:24, Dave wrote:
Yes, it was probably just a typeo on my part.
You've misspelled "typo"!
I’ve now fixed the majority of cases but still got two strings that look
identical but fail to match, this time (again by 10cc), “I’m Mandy Fly Me”.
Try printing the asciified string:
I hate regEx and avoid it whenever possible, I’ve never found something that
was impossible to do without it.
> On 8 Jun 2022, at 00:49, dn wrote:
>
> On 08/06/2022 10.18, De ongekruisigde wrote:
>> On 2022-06-08, Christian Gollwitzer wrote:
>>> Am 07.06.22 um 21:56 schrieb Dave:
It depen
On 08/06/2022 10.18, De ongekruisigde wrote:
> On 2022-06-08, Christian Gollwitzer wrote:
>> Am 07.06.22 um 21:56 schrieb Dave:
>>> It depends on the language I’m using, in Objective C, I’d use isNumeric,
>>> just wanted to know what the equivalent is in Python.
>>>
>>
>> Your problem is also a t
rotfl! Nice one!
> On 8 Jun 2022, at 00:24, 2qdxy4rzwzuui...@potatochowder.com wrote:
>
> On 2022-06-07 at 23:07:42 +0100,
> Regarding "Re: How to test characters of a string,"
> MRAB wrote:
>
>> On 2022-06-07 21:23, Dave wrote:
>>> Thanks a
Yes, it was probably just a typeo on my part.
I’ve now fixed the majority of cases but still got two strings that look
identical but fail to match, this time (again by 10cc), “I’m Mandy Fly Me”.
I’m putting money on it being a utf8 problem but I’m stuck on how to handle it.
It’s probably the si
It depends on the language I’m using, in Objective C, I’d use isNumeric,
just wanted to know what the equivalent is in Python.
If you know the answer why don’t you just tell me and if you don’t, don’t
post!
>>>
>>> People ask home work questions here and we try to teach
On 2022-06-08, Christian Gollwitzer wrote:
> Am 07.06.22 um 21:56 schrieb Dave:
>> It depends on the language I’m using, in Objective C, I’d use isNumeric,
>> just wanted to know what the equivalent is in Python.
>>
>
> Your problem is also a typical case for regular expressions. You can
> crea
Am 07.06.22 um 23:01 schrieb Christian Gollwitzer:
In [3]: re.sub(r'^\d+\s*', '', s) Out[3]: 'Trinket'
that RE does match what you intended to do, but not exactly what you
wrote in the OP. that would be '^\d\d.' start with exactly two digits
followed by any character.
Christian
-
Am 07.06.22 um 21:56 schrieb Dave:
It depends on the language I’m using, in Objective C, I’d use isNumeric, just
wanted to know what the equivalent is in Python.
Your problem is also a typical case for regular expressions. You can
create an expression for "starts with any number of digits pl
On 2022-06-07 at 23:07:42 +0100,
Regarding "Re: How to test characters of a string,"
MRAB wrote:
> On 2022-06-07 21:23, Dave wrote:
> > Thanks a lot for this! isDigit was the method I was looking for and
> > couldn’t find.
> >
> > I have another problem rel
On 2022-06-07 21:23, Dave wrote:
Thanks a lot for this! isDigit was the method I was looking for and couldn’t
find.
I have another problem related to this, the following code uses the code you
just sent. I am getting a files ID3 tags using eyed3, this part seems to work
and I get expected val
On 2022-06-08 at 07:29:03 +1000,
Chris Angelico wrote:
> On Wed, 8 Jun 2022 at 07:24, Barry wrote:
> >
> >
> >
> > > On 7 Jun 2022, at 22:04, Dave wrote:
> > >
> > > It depends on the language I’m using, in Objective C, I’d use isNumeric,
> > > just wanted to know what the equivalent is in Py
A, ok will do, was just trying to be a brief as possible, will post more
fully in future.
> On 7 Jun 2022, at 23:29, Chris Angelico wrote:
>
> On Wed, 8 Jun 2022 at 07:24, Barry wrote:
>>
>>
>>
>>> On 7 Jun 2022, at 22:04, Dave wrote:
>>>
>>> It depends on the language I’m using, in
On Wed, 8 Jun 2022 at 07:24, Barry wrote:
>
>
>
> > On 7 Jun 2022, at 22:04, Dave wrote:
> >
> > It depends on the language I’m using, in Objective C, I’d use isNumeric,
> > just wanted to know what the equivalent is in Python.
> >
> > If you know the answer why don’t you just tell me and if yo
> On 7 Jun 2022, at 22:04, Dave wrote:
>
> It depends on the language I’m using, in Objective C, I’d use isNumeric,
> just wanted to know what the equivalent is in Python.
>
> If you know the answer why don’t you just tell me and if you don’t, don’t
> post!
People ask home work questions h
Hi,
Found it! The files name had .mp3 at the end, the problem was being masked by
null objects (or whatever) being returned by eyed3.
Checked for null objects and then stripped off the .mp3 and its mostly working
now. I’ve got a few other eyed3 errors to do with null objects but I can sort
tho
Hi,
No, I’ve checked leading/trailing whitespace, it seems to be related to the
variables that are returned from eyed3 in this case, for instance, I added a
check for None:
myTitleName = myID3.tag.title
if myTitleName is None:
continue
Seems like it can return a null object (or none?).
>
It depends on the language I’m using, in Objective C, I’d use isNumeric, just
wanted to know what the equivalent is in Python.
If you know the answer why don’t you just tell me and if you don’t, don’t post!
> On 7 Jun 2022, at 22:08, 2qdxy4rzwzuui...@potatochowder.com wrote:
>
> On 2022-06-07
On 2022-06-07, Dave wrote:
> Thanks a lot for this! isDigit was the method I was looking for and couldn’t
> find.
>
> I have another problem related to this, the following code uses the code you
> just sent. I am getting a files ID3 tags using eyed3, this part seems to work
> and I get expected
On 2022-06-07, Stefan Ram wrote:
> Dave writes:
>>Example: if "05 Trinket" I want "Trinket"
>
> We're not supposed to write complete solutions,
Okay, wasn't aware of this group policy; will keep it in mind.
--
You're rewriting parts of Quake in *Python*?
MUAHAHAHA
--
https://mail.python.
On 2022-06-07 at 21:35:43 +0200,
Dave wrote:
> I’m new to Python and have a simple problem that I can’t seem to find
> the answer.
> I want to test the first two characters of a string to check if the
> are numeric (00 to 99) and if so remove the fist three chars from the
> string.
> Example: i
Thanks a lot for this! isDigit was the method I was looking for and couldn’t
find.
I have another problem related to this, the following code uses the code you
just sent. I am getting a files ID3 tags using eyed3, this part seems to work
and I get expected values in this case myTitleName (Track
On 2022-06-07, Dave wrote:
> Hi,
>
> I’m new to Python and have a simple problem that I can’t seem to find the
> answer.
>
> I want to test the first two characters of a string to check if the are
> numeric (00 to 99) and if so remove the fist three chars from the string.
>
> Example: if “05 Tr
On 08/06/2022 07.35, Dave wrote:
> Hi,
>
> I’m new to Python and have a simple problem that I can’t seem to find the
> answer.
> I want to test the first two characters of a string to check if the are
> numeric (00 to 99) and if so remove the fist three chars from the string.
>
> Example: if
Why not just have scripts that echo out the various sets of test
data you are interested in? That way, Popen would
always be your interface and you wouldn't have to
make two cases in the consumer script.
In other words, make program that outputs test
data just like your main data source program.
Op 11/03/2022 om 10:11 schreef Roel Schroeven:
Op 10/03/2022 om 13:16 schreef Loris Bennett:
Hi,
I have a command which produces output like the
following:
Job ID: 9431211
Cluster: curta
User/Group: build/staff
State: COMPLETED (exit code 0)
Nodes: 1
Cores per node: 8
CPU
Op 10/03/2022 om 13:16 schreef Loris Bennett:
Hi,
I have a command which produces output like the
following:
Job ID: 9431211
Cluster: curta
User/Group: build/staff
State: COMPLETED (exit code 0)
Nodes: 1
Cores per node: 8
CPU Utilized: 01:30:53
CPU Efficiency: 83.63% of
Loris Bennett wrote at 2022-3-11 07:40 +0100:
> ... I want to test the parsing ...
>Sorry if I was unclear but my question is:
>
>Given that the return value from Popen is a Popen object and given that
>the return value from reading a file is a single string or maybe a list
>of strings, what should
Dieter Maurer writes:
> Loris Bennett wrote at 2022-3-10 13:16 +0100:
>>I have a command which produces output like the
>>following:
>>
>> Job ID: 9431211
>> Cluster: curta
>> User/Group: build/staff
>> State: COMPLETED (exit code 0)
>> Nodes: 1
>> Cores per node: 8
>> CPU Utilized: 01:30:
Loris Bennett wrote at 2022-3-10 13:16 +0100:
>I have a command which produces output like the
>following:
>
> Job ID: 9431211
> Cluster: curta
> User/Group: build/staff
> State: COMPLETED (exit code 0)
> Nodes: 1
> Cores per node: 8
> CPU Utilized: 01:30:53
> CPU Efficiency: 83.63% of 01:4
> On 23 Jan 2022, at 17:08, Chris Green wrote:
>
> Barry Scott wrote:
>>
>>
On 22 Jan 2022, at 21:26, Chris Green wrote:
>>>
>>> I have a script that walks a quite deep tree of mail messages to find
>>> and archive old messages. I'm trying to convert it from mbox to
>>> maildir (as
Barry Scott wrote:
>
>
> > On 22 Jan 2022, at 21:26, Chris Green wrote:
> >
> > I have a script that walks a quite deep tree of mail messages to find
> > and archive old messages. I'm trying to convert it from mbox to
> > maildir (as I now store my mail in maildir format).
> >
> > So I need
Cameron Simpson wrote:
> On 22Jan2022 21:26, Chris Green wrote:
> >So I need to test whether a point I have reached in the hierarchy is a
> >maildir mailbox or not. Using mbox format it's easy because 'folders'
> >are directories and mailboxes are files. However with maildir the
> >'folders' ha
> On 22 Jan 2022, at 21:26, Chris Green wrote:
>
> I have a script that walks a quite deep tree of mail messages to find
> and archive old messages. I'm trying to convert it from mbox to
> maildir (as I now store my mail in maildir format).
>
> So I need to test whether a point I have reached
On 22Jan2022 21:26, Chris Green wrote:
>So I need to test whether a point I have reached in the hierarchy is a
>maildir mailbox or not. Using mbox format it's easy because 'folders'
>are directories and mailboxes are files. However with maildir the
>'folders' have directories within them so the
On Wed, 17 Jun 2020 17:34:55 +0100
Tony Flury wrote:
> On 24/04/2020 19:40, Manfred Lotz wrote:
> > I have a command like application which checks a directory tree for
> > certain things. If there are errors then messages will be written to
> > stdout.
> >
> > How to test this in the best way?
>
On 5/1/20 2:34 PM, DL Neil via Python-list wrote:
>>> Given your replies, 'now' might be a good time to take a look at
>>> Pytest, and see how you could use it to help build better code - by
>>> building tested units/functions which are assembled into ever-larger
>>> tested-units... (there is a ran
Worth noting: by assertTrue he probably meant assertEqual.
But I'd recommend using assertIn [1] if you're using unittest to check
output written to stdout/stderr.
That way, your tests are slightly more robust to changes in the exact
output.
pytest may also be helpful for this (or any!) type of te
On 6/17/2020 12:34 PM, Tony Flury via Python-list wrote:
In a recent application that I wrote (where output to the console was
important), I tested it using the 'unittest' framework, and by patching
sys.stderr to be a StringIO - that way my test case could inspect what
was being output.
Tony
On 24/04/2020 19:40, Manfred Lotz wrote:
I have a command like application which checks a directory tree for
certain things. If there are errors then messages will be written to
stdout.
How to test this in the best way?
One idea was for the error situations to write messages to files and
then
Given your replies, 'now' might be a good time to take a look at
Pytest, and see how you could use it to help build better code - by
building tested units/functions which are assembled into ever-larger
tested-units... (there is a range of choice/other testing aids if
Pytest doesn't take your fancy
On Mon, 27 Apr 2020 18:21:39 +1200
DL Neil wrote:
...
>
> Given your replies, 'now' might be a good time to take a look at
> Pytest, and see how you could use it to help build better code - by
> building tested units/functions which are assembled into ever-larger
> tested-units... (there is a r
If I have understood correctly, the objective is to check a dir-tree
to ensure that specific directory/file-permissions are in-effect/have
not been changed. The specifications come from a .JSON file and may
be over-ridden by command-line arguments. Correct?
Yes.
How to test this in the best
On Sun, 26 Apr 2020 15:26:58 +1200
DL Neil wrote:
> On 25/04/20 7:53 PM, Manfred Lotz wrote:
> > On Sat, 25 Apr 2020 18:41:37 +1200
> > DL Neil wrote:
> >
> >> On 25/04/20 5:16 PM, Manfred Lotz wrote:
> >>> On Fri, 24 Apr 2020 19:12:39 -0300
> >>> Cholo Lennon wrote:
> >>>
> On
On 25/04/20 7:53 PM, Manfred Lotz wrote:
On Sat, 25 Apr 2020 18:41:37 +1200
DL Neil wrote:
On 25/04/20 5:16 PM, Manfred Lotz wrote:
On Fri, 24 Apr 2020 19:12:39 -0300
Cholo Lennon wrote:
On 24/4/20 15:40, Manfred Lotz wrote:
I have a command like application which checks a directory tr
On 4/25/20 2:16 AM, Manfred Lotz wrote:
On Fri, 24 Apr 2020 19:12:39 -0300
Cholo Lennon wrote:
On 24/4/20 15:40, Manfred Lotz wrote:
I have a command like application which checks a directory tree for
certain things. If there are errors then messages will be written to
stdout.
How to test th
On Sat, 25 Apr 2020 18:41:37 +1200
DL Neil wrote:
> On 25/04/20 5:16 PM, Manfred Lotz wrote:
> > On Fri, 24 Apr 2020 19:12:39 -0300
> > Cholo Lennon wrote:
> >
> >> On 24/4/20 15:40, Manfred Lotz wrote:
> >>> I have a command like application which checks a directory tree
> >>> for certain
On 25/04/20 5:16 PM, Manfred Lotz wrote:
On Fri, 24 Apr 2020 19:12:39 -0300
Cholo Lennon wrote:
On 24/4/20 15:40, Manfred Lotz wrote:
I have a command like application which checks a directory tree for
certain things. If there are errors then messages will be written to
stdout.
How to test t
On 24 Apr 2020 22:18:45 GMT
r...@zedat.fu-berlin.de (Stefan Ram) wrote:
> DL Neil writes:
> >Python's logging library enables messages to be formatted
> >accordingly, and directed differently, depending upon 'level of
> >severity'. So, as well as the flexibility mentioned before, there is
> >an o
On Fri, 24 Apr 2020 19:12:39 -0300
Cholo Lennon wrote:
> On 24/4/20 15:40, Manfred Lotz wrote:
> > I have a command like application which checks a directory tree for
> > certain things. If there are errors then messages will be written to
> > stdout.
> >
> > How to test this in the best way?
>
On 24/4/20 15:40, Manfred Lotz wrote:
I have a command like application which checks a directory tree for
certain things. If there are errors then messages will be written to
stdout.
How to test this in the best way?
One idea was for the error situations to write messages to files and
then late
May I point-out that the above may not be the best approach. Rather
than using screen-prints to report errors, another method is to
utilise "logging" to collect such data - so that there is always a
formal record (regardless of user behavior). During 'production' the
information could be collected
On Sat, 25 Apr 2020 08:25:00 +1200
DL Neil wrote:
> On 25/04/20 6:40 AM, Manfred Lotz wrote:
> > I have a command like application which checks a directory tree for
> > certain things. If there are errors then messages will be written to
> > stdout.
> >
> > How to test this in the best way?
> >
On 24 Apr 2020 20:17:04 GMT
r...@zedat.fu-berlin.de (Stefan Ram) wrote:
> Manfred Lotz writes:
> >I have a command like application which checks a directory tree for
> >certain things. If there are errors then messages will be written to
> >stdout.
>
> Error messages should be written to sys
On 25/04/20 6:40 AM, Manfred Lotz wrote:
I have a command like application which checks a directory tree for
certain things. If there are errors then messages will be written to
stdout.
How to test this in the best way?
One idea was for the error situations to write messages to files and
then l
He is talking about this.
https://mail.python.org/mailman/listinfo/python-list
Scroll down to the bottom of the page and you will find overview of
all..
Souvik flutter dev
On Fri, Apr 24, 2020, 7:50 AM Deac-33 Lancaster wrote:
> On Thursday, April 23, 2020 at 7:14:16 PM UTC-7, DL Neil wrote
On Thursday, April 23, 2020 at 7:14:16 PM UTC-7, DL Neil wrote:
> ... Is there a way to see all of the groups?
>
> Yes! Follow the link at the bottom of this email msg. Then follow the
> link at the bottom of this list's web-page ...
> --
> Regards =dn
Sorry, I don't see the link.
-deac33
--
h
... Is there a way to see all of the groups?
Yes! Follow the link at the bottom of this email msg. Then follow the
link at the bottom of this list's web-page ...
--
Regards =dn
--
https://mail.python.org/mailman/listinfo/python-list
On Thursday, April 23, 2020 at 7:11:47 PM UTC-7, DL Neil wrote:
> On 24/04/20 1:24 PM, Deac-33 Lancaster wrote:
> > I'm aware that you can find the type of a variable with
> > type(var)
> >
> > But are there Boolean operators in Python3.8 to test the data type, e.g.
> >is_floate(var)
> >
On 24/04/20 1:24 PM, Deac-33 Lancaster wrote:
I'm aware that you can find the type of a variable with
type(var)
But are there Boolean operators in Python3.8 to test the data type, e.g.
is_floate(var)
is_string(var)
etc. ?
There is also a 'pythonic' answer (what is the 'Python way'?)
On Thursday, April 23, 2020 at 6:47:04 PM UTC-7, DL Neil wrote:
> On 24/04/20 1:24 PM, Deac-33 Lancaster wrote:
> > I'm aware that you can find the type of a variable with
> > type(var)
> >
> > But are there Boolean operators in Python3.8 to test the data type, e.g.
> >is_floate(var)
> >
On Thursday, April 23, 2020 at 6:46:14 PM UTC-7, Alan Bawden wrote:
> Deac-33 Lancaster writes:
>
> > I'm aware that you can find the type of a variable with
> >type(var)
>
> (Strictly speaking, variables don't have types. This gives you the type of
> the variable's current value. But we
Deac-33 Lancaster writes:
> I'm aware that you can find the type of a variable with
>type(var)
(Strictly speaking, variables don't have types. This gives you the type of
the variable's current value. But we know what you meant.)
> But are there Boolean operators in Python3.8 to test the
ChrisA,
Most awesome, thank you very much, I just couldn't find that in the docs.
Still learning!
Much thanks,
-deac33
--
https://mail.python.org/mailman/listinfo/python-list
On 24/04/20 1:24 PM, Deac-33 Lancaster wrote:
I'm aware that you can find the type of a variable with
type(var)
But are there Boolean operators in Python3.8 to test the data type, e.g.
is_floate(var)
is_string(var)
etc. ?
You are close! https://docs.python.org/3/library/functions.htm
On Fri, Apr 24, 2020 at 11:26 AM Deac-33 Lancaster wrote:
>
> I'm aware that you can find the type of a variable with
>type(var)
>
> But are there Boolean operators in Python3.8 to test the data type, e.g.
> is_floate(var)
> is_string(var)
> etc. ?
>
> (If this is the wrong group for this
Very late to the party, but I just encountered a very similar problem and found
a solution:
```
import collections
obj = {"foo": "bar"}
isinstance(obj.values(), collections.abc.ValuesView) # => True
```
Hope that helps someone out there :)
On Thursday, November 17, 2016 at 9:09:23 AM UTC-8, Te
On 11/17/2016 9:57 AM, Thorsten Kampe wrote:
The code in question is part of an attempt to get the dimensions of
multi-dimensional lists, the `isinstance` is there in order to
exclude strings.
You can do the exclusion directly.
"""
def dim(seq):
dimension = []
while isinstance(seq,
* Peter Otten (Thu, 17 Nov 2016 13:38:26 +0100)
>
> Thorsten Kampe wrote:
>
> > How can I test for type or instance of dictviews like dict_values?
>
> Why do you want to?
Thanks, for the `collections.abc.ValuesView` tip.
The code in question is part of an attempt to get the dimensions of
mult
Thorsten Kampe wrote:
> How can I test for type or instance of dictviews like dict_values?
Why do you want to?
> `isinstance({}.values, dict_values)` gives
> `NameError: name 'dict_values' is not defined`
You can "fix" this with
>>> dict_values = type({}.values())
or, depending on the use ca
On Sat, 10 Dec 2011 09:19:31 -0800, xDog Walker wrote:
> Use standard Python dictionary functions such as has_key to test whether
> an element exists.
Idiomatic Python code today no longer uses has_key.
# Was:
d.feed.has_key('title')
# Now preferred
'title' in d.feed
--
Steven
--
http://ma
On Thursday 2011 December 08 01:34, HansPeter wrote:
> Hi,
>
> While using the feedparser library for downloading RSS feeds some of
> the blog entries seem to have no title.
>
> File "build\bdist.win32\egg\feedparser.py", line 382, in __getattr__
> AttributeError: object has no attribute 'title'
>
On Thu, Dec 8, 2011 at 1:34 AM, HansPeter wrote:
> Hi,
>
> While using the feedparser library for downloading RSS feeds some of
> the blog entries seem to have no title.
>
> File "build\bdist.win32\egg\feedparser.py", line 382, in __getattr__
> AttributeError: object has no attribute 'title'
>
>
On Mon, 17 Oct 2011 18:59:44 -0600, Ian Kelly wrote:
> On Mon, Oct 17, 2011 at 6:40 PM, Chris Kaynor
> wrote:
>> Python 2.6 running on Windows 7:
> 99.0**99**99
>> OverflowError: (34, 'Result too large') Traceback (most recent call
>> last):
>> File "", line 1, in
>> OverflowError: (34, 'R
- Original Message -
> From: Noah Hall
> To: MrPink
> Cc: python-list@python.org
> Sent: Tuesday, October 18, 2011 4:44 AM
> Subject: Re: How to test if object is an integer?
> There's the isdigit method, for example -
>
>>>> str = "13
On Mon, Oct 17, 2011 at 6:40 PM, Chris Kaynor wrote:
> Python 2.6 running on Windows 7:
99.0**99**99
> OverflowError: (34, 'Result too large')
> Traceback (most recent call last):
> File "", line 1, in
> OverflowError: (34, 'Result too large')
>
> However, from the documentation:
> "Becaus
Python 2.6 running on Windows 7:
>>> 99.0**99**99
OverflowError: (34, 'Result too large')
Traceback (most recent call last):
File "", line 1, in
OverflowError: (34, 'Result too large')
However, from the documentation:
"Because of the lack of standardization of floating point exception
handling
In article ,
Mathias Lafeldt wrote:
> According to [1], there're more Exceptions to test for:
>
> try:
> int(s)
> return True
> except (TypeError, ValueError, OverflowError): # int conversion failed
> return False
I don't think I would catch TypeError here. It kind of depends on
On Mon, Oct 17, 2011 at 2:44 PM, Noah Hall wrote:
> There's the isdigit method, for example -
>
str = "1324325"
str.isdigit()
> True
str = "1232.34"
str.isdigit()
> False
str = "I am a string, not an int!"
str.isdigit()
> False
That works for non-negative base-10 int
On Sat, Oct 15, 2011 at 12:44 AM, MrPink wrote:
>
> Is there a function in Python that can be used to test if the value in
> a string is an integer? I had to make one up for myself and it looks
> like this:
>
> def isInt(s):
> try:
> i = int(s)
> return True
> except ValueErro
On Sat, Oct 15, 2011 at 1:44 AM, MrPink wrote:
>
> Is there a function in Python that can be used to test if the value in
> a string is an integer? I had to make one up for myself and it looks
> like this:
>
> def isInt(s):
> try:
> i = int(s)
> return True
> except ValueError
On 10/14/2011 9:51 PM, Ben Finney wrote:
Terry Reedy writes:
On 10/14/2011 9:05 PM, Chris Angelico wrote:
That tests if the object is already an int; the OP asked if a string
contains an integer.
The misleading subject line did not. It should have been "How to test
if a string contains an
Terry Reedy writes:
> On 10/14/2011 9:05 PM, Chris Angelico wrote:
> > That tests if the object is already an int; the OP asked if a string
> > contains an integer.
>
> The misleading subject line did not. It should have been "How to test
> if a string contains an integer?"
Which would still be
1 - 100 of 282 matches
Mail list logo