Count how many zeros are at the end of your int:
defend_zeros(num):
s = str(num)
return len(s) - len(s.rstrip("0"))
print(end_zeros(10)) # == 1
print(end_zeros(101)) # == 0
print(end
I'd wish to have this challenge posted on my blog but because I suck in
IT english, could you guys help me with decribing the task of what the
code supposed to do?
--
Thanks
--
https://mail.python.org/mailman/listinfo/python-list
On 08/02/2021 13.12, Schachner, Joseph wrote:
This code works:
mystr = "hello"
for ch in mystr:
print(ch, end="")
result is: hello
Note that the for loop does not use range. Strings are iterable, that is they
support Python's iteration protocol. So, for ch in mystr: assign
-Original Message-
From: Michael F. Stemper
Sent: Monday, February 8, 2021 9:19 AM
To: python-list@python.org
Subject: Re: Python cannot count apparently
On 07/02/2021 13.34, Philipp Daher wrote:
> Hello,
>
> I recently coded this snippet of code:
> myString=„hello“
&g
On 07/02/2021 13.34, Philipp Daher wrote:
Hello,
I recently coded this snippet of code:
myString=„hello“
for i in range(len(myString):
print(string[i])
And now for the weird part:
SOMETIMES, the output is this:
hello
Strange. When I fix the errors in what you posted:
- wrong character
On Sun, 7 Feb 2021 20:49:52 + (UTC), Kevin M. Wilson wrote:
> Set i = 0 at the begin of the code, that way each entry starts at
> Logical 0 of the array/container/list...
No. The original code, as posted, was
>>I recently coded this snippet of code:
>>myString=„hello“
>>for i in
On 08/02/2021 09.49, Kevin M. Wilson via Python-list wrote:
> Set i = 0 at the begin of the code, that way each entry starts at Logical 0
> of the array/container/list...
FYI: https://docs.python.org/3/library/stdtypes.html#typesseq-range
See also @Chris' contribution regarding the pythonic idi
Set i = 0 at the begin of the code, that way each entry starts at Logical 0 of
the array/container/list...
"The only way to have experience is by having the experience"!
On Sunday, February 7, 2021, 12:56:40 PM MST, Karsten Hilbert
wrote:
Am Sun, Feb 07, 2021 at 07:47:03PM + schr
Am Sun, Feb 07, 2021 at 07:47:03PM + schrieb Paul Bryan:
> That's not the only problem with the code. There's a missing close-
> paren and a reference to "string" which I presume was meant to be
> "myString".
I know. I wasn't going to spoil everything right away. The
sort of response we would
That's not the only problem with the code. There's a missing close-
paren and a reference to "string" which I presume was meant to be
"myString".
Suggest OP create a reproducible case, and paste the code and output
verbatim.
On Sun, 2021-02-07 at 20:40 +0100, Karsten Hilbert wrote:
> Am Sun, Feb
On Sun, Feb 7, 2021 at 2:36 PM Philipp Daher via Python-list
wrote:
>
> Hello,
>
> I recently coded this snippet of code:
> myString=„hello“
> for i in range(len(myString):
> print(string[i])
>
> And now for the weird part:
>
> SOMETIMES, the output is this:
>
> hello
>
> And SOMETIMES, the o
On Mon, Feb 8, 2021 at 6:36 AM Philipp Daher via Python-list
wrote:
>
> Hello,
>
> I recently coded this snippet of code:
> myString=„hello“
> for i in range(len(myString):
> print(string[i])
This code won't work as is. Please *copy and paste* your code when
asking for help.
> And now for t
Am Sun, Feb 07, 2021 at 08:34:34PM +0100 schrieb Philipp Daher via Python-list:
> I recently coded this snippet of code:
> myString=„hello“
I doubt you have (coded *this* snippet of code) -- because
those quotes wouldn't work.
Karsten
--
GPG 40BE 5B0E C98E 1713 AFA6 5BC0 3BEA AC80 7D4F C89B
--
Hello,
I recently coded this snippet of code:
myString=„hello“
for i in range(len(myString):
print(string[i])
And now for the weird part:
SOMETIMES, the output is this:
hello
And SOMETIMES, the output changes to:
ohell
WHY??? Why do I get different outputs with the EXACT SAME CODE?
Can
ch I can append character if not in lil.
How often does Tim's solution?
oh here Im stuck and dont understand what you mean?
[Tim Chase]
def consecutive_counter(seq):
# I'm not sure if there's something
# like this already in itertools
cur = nada = objec
On 2021-01-19, Peter Otten <__pete...@web.de> wrote:
> On 19/01/2021 04:45, Bischoop wrote:
>
>> I sat to it again and solved it.
>
> Congratulations!
>
> > lil = tuple(set(s)) # list of characters in s
> >
> > li=[0,0,0,0,0,0] # list for counted repeats
>
> I see a minor problem here. What happen
On 19/01/2021 04:45, Bischoop wrote:
I sat to it again and solved it.
Congratulations!
> lil = tuple(set(s)) # list of characters in s
>
> li=[0,0,0,0,0,0] # list for counted repeats
I see a minor problem here. What happens if s contains more than len(li)
characters?
import timeit
Since
On 2021-01-14, Stefan Ram wrote:
>
> If you want to know why, maybe you should insert print
> statements to see the values of critical variables and
> expression, especially in loops.
>
> Then compare the printed values with your expectations.
>
> Also, decompose into meaningful functio
way
to spell this?
if not string:
return (0, [])
grouped = itertools.groupby(string)
grouped_with_lengths = [(len(list(value)), key) for key, value in
grouped]
max_count_and_letter = max(grouped_with_lengths)
max_count = max_count_and_letter[0]
result = (ma
typing.Tuple[int, typing.List[str]]:
"""Get the longest run of a single consecutive character."""
if not string:
return (0, [])
grouped = itertools.groupby(string)
grouped_with_lengths = [(len(list(value)), key) for key, value in
gr
On 2021-01-16 03:32, Bischoop wrote:
>> The OP didn't specify what should happen in that case, so it would
>> need some clarification.
>
> In that case maybe good solution would be to return three of them?
That's the solution I chose in my initial reply, you get a tuple back
of ([list of longest
On 2021-01-14, Tim Chase wrote:
>
> seems to only return one value so seems to get odd results if I
> specify something like
>
> get_longest("aaabcccbbb")
>
> which at least here tells me that "c" is the longest run, even though
> aaa, bbb, and ccc are all runs of length 3. The OP didn't specif
Am 13.01.2021 um 22:20 schrieb Bischoop:
I want to to display a number or an alphabet which appears mostly
consecutive in a given string or numbers or both
Examples
s= ' aabskaaabad'
output: c
# c appears 4 consecutive times
8bbakebaoa
output: b
#b appears 2 consecutive times
You can
On 2021-01-13, Bischoop wrote:
I know what was wrong:
> m = s.index(i)
I forgot that m will return first index of i.
So tried that way but still getting out of index although I that that
I'm making sure not to get out of index.
s = 'aabskaaabadh'
c = 0
t = list(set(s)) # list
On Wed, Jan 13, 2021 at 6:20 PM Dan Stromberg wrote:
> On Wed, Jan 13, 2021 at 5:59 PM Tim Chase
> wrote:
>
>> On 2021-01-13 21:20, Bischoop wrote:
>> > I want to to display a number or an alphabet which appears mostly
>> > consecutive in a given string or numbers or both
>> > Examples
>> > s=
On 2021-01-13 18:20, Dan Stromberg wrote:
> I'm kind of partial to:
>
> import collections
> import typing
>
>
> def get_longest(string: str) -> typing.Tuple[int, str]:
> """Get the longest run of a single consecutive character."""
> dict_: typing.DefaultDict[str, int] =
> collections.de
On Wed, Jan 13, 2021 at 5:59 PM Tim Chase
wrote:
> On 2021-01-13 21:20, Bischoop wrote:
> > I want to to display a number or an alphabet which appears mostly
> > consecutive in a given string or numbers or both
> > Examples
> > s= ' aabskaaabad'
> > output: c
> > # c appears 4 consecutive ti
b
> #b appears 2 consecutive times
I'd break the problem into two parts:
1) iterate over your thing (in this case, a string) and emit the item
and its correpsonding count of consecutive matches.
2) feed that into something that finds the longest run(s) output by
that.
So off the cuff, som
On 2021-01-13, Bischoop wrote:
> t = set(s) # set of characters in s
I have this one changed to:
t= list(set(s))
--
https://mail.python.org/mailman/listinfo/python-list
d for each element loop the string
to check if equal with element set element if so count =+1 and check if
next to it is not equal add counter value to list with same index as in
set.
However I'm fighting to code it and the counting numbers are not right:
s = 'aabskaaabad'
c = 0
t = s
On 15 Apr 2020 10:28, Peter Otten <__pete...@web.de> wrote:
sjeik_ap...@hotmail.com wrote:
> On 12 Apr 2020 12:30, Peter Otten <__pete...@web.de> wrote:
>
> Rahul Gupta wrote:
>
> >for line in enumerate(csv_reader):
> >print(line[csv_reader.
sjeik_ap...@hotmail.com wrote:
>On 12 Apr 2020 12:30, Peter Otten <__pete...@web.de> wrote:
>
> Rahul Gupta wrote:
>
> >for line in enumerate(csv_reader):
> >print(line[csv_reader.fieldnames[1]])
>
> enumerate() generates (index, line) tuples that you need to unpack:
>
On 12 Apr 2020 12:30, Peter Otten <__pete...@web.de> wrote:
Rahul Gupta wrote:
> for line in enumerate(csv_reader):
> print(line[csv_reader.fieldnames[1]])
enumerate() generates (index, line) tuples that you need to unpack:
for index, line in enumerat
@Peter Thanks alot
--
https://mail.python.org/mailman/listinfo/python-list
track of the row count you can modify the above like so:
row_count = 0
for row_count, line in enumerate(csv_reader, 1):
print(line[csv_reader.fieldnames[1]])
--
https://mail.python.org/mailman/listinfo/python-list
import csv
import numpy as np
with open("D:\PHD\obranking\\cell_split_demo.csv", mode='r') as csv_file:
csv_reader = csv.DictReader(csv_file)
print(csv_reader.fieldnames)
col_count = print(len(csv_reader.fieldnames))
#print(sum(1 for row in csv_file))
row_count = 0
Rahul Gupta wrote:
> On Sunday, April 12, 2020 at 1:35:10 PM UTC+5:30, Rahul Gupta wrote:
>> the cells in my csv that i wrote looks likes this
>>
['82#201#426#553#602#621#811#908#1289#1342#1401#1472#1593#1641#1794#2290#2341#2391#3023#3141#3227#3240#3525#3529#3690#3881#4406#4421#4497#4719#4722#492
On Sunday, April 12, 2020 at 1:35:10 PM UTC+5:30, Rahul Gupta wrote:
> the cells in my csv that i wrote looks likes this
> ['82#201#426#553#602#621#811#908#1289#1342#1401#1472#1593#1641#1794#2290#2341#2391#3023#3141#3227#3240#3525#3529#3690#3881#4406#4421#4497#4719#4722#4920#5053#5146#5433']
> and
Rahul Gupta wrote:
> the cells in my csv that i wrote looks likes this
>
['82#201#426#553#602#621#811#908#1289#1342#1401#1472#1593#1641#1794#2290#2341#2391#3023#3141#3227#3240#3525#3529#3690#3881#4406#4421#4497#4719#4722#4920#5053#5146#5433']
> and the cells which are empty looks like [''] i have
the cells in my csv that i wrote looks likes this
['82#201#426#553#602#621#811#908#1289#1342#1401#1472#1593#1641#1794#2290#2341#2391#3023#3141#3227#3240#3525#3529#3690#3881#4406#4421#4497#4719#4722#4920#5053#5146#5433']
and the cells which are empty looks like ['']
i have tried the following code
Sayth Renshaw schreef op 11/09/2019 om 12:11:
I want to allow as many lists as needed to be passed into a function.
But how can I determine how many lists have been passed in?
I expected this to return 3 but it only returned 1.
matrix1 = [[1, -2], [-3, 4],]
matrix2 = [[2, -1], [0, -1]]
matrix3
> I expected this to return 3 but it only returned 1.
>
> matrix1 = [[1, -2], [-3, 4],]
> matrix2 = [[2, -1], [0, -1]]
> matrix3 = [[2, -1], [0, -1]]
>
> def add(*matrix):
> print(len(locals()))
>
> print(add(matrix1, matrix2))
In this case, locals will be a dictionary with exactly one key.
Le 11/09/2019 à 12:11, Sayth Renshaw a écrit :
Hi
I want to allow as many lists as needed to be passed into a function.
But how can I determine how many lists have been passed in?
I expected this to return 3 but it only returned 1.
matrix1 = [[1, -2], [-3, 4],]
matrix2 = [[2, -1], [0, -1]]
mat
On Wednesday, 11 September 2019 20:25:32 UTC+10, Sayth Renshaw wrote:
> On Wednesday, 11 September 2019 20:11:21 UTC+10, Sayth Renshaw wrote:
> > Hi
> >
> > I want to allow as many lists as needed to be passed into a function.
> > But how can I determine how many lists have been passed in?
> >
On Wednesday, 11 September 2019 20:11:21 UTC+10, Sayth Renshaw wrote:
> Hi
>
> I want to allow as many lists as needed to be passed into a function.
> But how can I determine how many lists have been passed in?
>
> I expected this to return 3 but it only returned 1.
>
> matrix1 = [[1, -2], [-3,
Hi
I want to allow as many lists as needed to be passed into a function.
But how can I determine how many lists have been passed in?
I expected this to return 3 but it only returned 1.
matrix1 = [[1, -2], [-3, 4],]
matrix2 = [[2, -1], [0, -1]]
matrix3 = [[2, -1], [0, -1]]
# print(add(matrix1, ma
On 24/05/2018 03:37, Terry Reedy wrote:
On 5/23/2018 8:46 PM, bartc wrote:
On 24/05/2018 00:44, Terry Reedy wrote:
On 5/23/2018 5:56 PM, Rob Gaddi wrote:
On 05/23/2018 02:51 PM, asa32s...@gmail.com wrote:
s = "kitti"
0,1,2,3,4
k,i,t,t,i
how do i retrieve '4'. i know i can do a len(s)-1,
U
On 5/23/2018 8:46 PM, bartc wrote:
On 24/05/2018 00:44, Terry Reedy wrote:
On 5/23/2018 5:56 PM, Rob Gaddi wrote:
On 05/23/2018 02:51 PM, asa32s...@gmail.com wrote:
s = "kitti"
0,1,2,3,4
k,i,t,t,i
how do i retrieve '4'. i know i can do a len(s)-1,
Use -1, which is the same as len(s)-1 but
On 23May2018 23:14, Mark Lawrence wrote:
On 23/05/18 22:56, Rob Gaddi wrote:
On 05/23/2018 02:51 PM, asa32s...@gmail.com wrote:
s = "kitti"
0,1,2,3,4
k,i,t,t,i
how do i retrieve '4'. i know i can do a len(s)-1, but i assume
there is a function that gives me last number of index
Not sure
On 24/05/2018 01:46, bartc wrote:
On 24/05/2018 00:44, Terry Reedy wrote:
On 5/23/2018 5:56 PM, Rob Gaddi wrote:
On 05/23/2018 02:51 PM, asa32s...@gmail.com wrote:
s = "kitti"
0,1,2,3,4
k,i,t,t,i
how do i retrieve '4'. i know i can do a len(s)-1,
Use -1, which is the same as len(s)-1 but f
On 24/05/2018 00:44, Terry Reedy wrote:
On 5/23/2018 5:56 PM, Rob Gaddi wrote:
On 05/23/2018 02:51 PM, asa32s...@gmail.com wrote:
s = "kitti"
0,1,2,3,4
k,i,t,t,i
how do i retrieve '4'. i know i can do a len(s)-1,
Use -1, which is the same as len(s)-1 but faster.
This illustrates one probl
On 5/23/2018 6:07 PM, asa32s...@gmail.com wrote:
On Wednesday, May 23, 2018 at 5:51:42 PM UTC-4, asa3...@gmail.com wrote:
s = "kitti"
0,1,2,3,4
k,i,t,t,i
how do i retrieve '4'. i know i can do a len(s)-1, but i assume there is a
function that gives me last number of index
thanks
thanks, it
On 5/23/2018 5:56 PM, Rob Gaddi wrote:
On 05/23/2018 02:51 PM, asa32s...@gmail.com wrote:
s = "kitti"
0,1,2,3,4
k,i,t,t,i
how do i retrieve '4'. i know i can do a len(s)-1,
Use -1, which is the same as len(s)-1 but faster.
>>> s = 'kitty'
>>> s[len(s)-1]
'y'
>>> s[-1]
'y'
--
Terry Jan Ree
On 23/05/18 22:56, Rob Gaddi wrote:
On 05/23/2018 02:51 PM, asa32s...@gmail.com wrote:
s = "kitti"
0,1,2,3,4
k,i,t,t,i
how do i retrieve '4'. i know i can do a len(s)-1, but i assume there
is a function that gives me last number of index
thanks
Not sure I'm following your question; len(s
On Wednesday, May 23, 2018 at 5:51:42 PM UTC-4, asa3...@gmail.com wrote:
> s = "kitti"
>
> 0,1,2,3,4
> k,i,t,t,i
>
> how do i retrieve '4'. i know i can do a len(s)-1, but i assume there is a
> function that gives me last number of index
>
> thanks
thanks, it seems just a len(s) -1 is the righ
On 23/05/2018 22:51, asa32s...@gmail.com wrote:
s = "kitti"
0,1,2,3,4
k,i,t,t,i
how do i retrieve '4'. i know i can do a len(s)-1, but i assume there is a
function that gives me last number of index
Not for that trivial task. But you can create your own:
def upb(x): return len(x)-1 # '
On Wednesday, May 23, 2018 at 5:56:26 PM UTC-4, Rob Gaddi wrote:
> On 05/23/2018 02:51 PM, asa32s...@gmail.com wrote:
> > s = "kitti"
> >
> > 0,1,2,3,4
> > k,i,t,t,i
> >
> > how do i retrieve '4'. i know i can do a len(s)-1, but i assume there is a
> > function that gives me last number of index
On 05/23/2018 02:51 PM, asa32s...@gmail.com wrote:
s = "kitti"
0,1,2,3,4
k,i,t,t,i
how do i retrieve '4'. i know i can do a len(s)-1, but i assume there is a
function that gives me last number of index
thanks
Not sure I'm following your question; len(s)-1 is much faster than
enumerating o
s = "kitti"
0,1,2,3,4
k,i,t,t,i
how do i retrieve '4'. i know i can do a len(s)-1, but i assume there is a
function that gives me last number of index
thanks
--
https://mail.python.org/mailman/listinfo/python-list
;while" loop
> > >
> > > Have you tried putting the 'if' statement inside the 'while' loop?
> > >
> > > If not, give it a shot and see what happens.
> > >
> > > Frank Millman
> >
> > I tried this :
> >
&g
t;
> > Sure, so how would the code look like if I want the "if" statement to
> > be
> > nested inside the "while" loop
>
> Have you tried putting the 'if' statement inside the 'while' loop?
>
> If not, give it a shot and see wh
nested inside the "while" loop
>
> Have you tried putting the 'if' statement inside the 'while' loop?
>
> If not, give it a shot and see what happens.
>
> Frank Millman
I tried this :
count = 0
while count < 10:
if count < 5:
prin
"Cai Gengyang" wrote in message
news:c2dfc9c4-3e16-480c-aebf-553081775...@googlegroups.com...
Sure, so how would the code look like if I want the "if" statement to be
nested inside the "while" loop
Have you tried putting the 'if' statement inside the 'while' loop?
If not, give it a shot and
On Tuesday, November 28, 2017 at 6:09:17 AM UTC+8, Ned Batchelder wrote:
> On 11/27/17 7:54 AM, Cai Gengyang wrote:
> > Input :
> >
> > count = 0
> >
> > if count < 5:
> > print "Hello, I am an if statement and count is", count
> >
&
Input :
count = 0
if count < 5:
print "Hello, I am an if statement and count is", count
while count < 10:
print "Hello, I am a while and count is", count
count += 1
Output :
Hello, I am an if statement and count is 0 Hello, I am a while and count is 0
Hello, I
On 11/27/17 7:54 AM, Cai Gengyang wrote:
> Input :
>
> count = 0
>
> if count < 5:
>print "Hello, I am an if statement and count is", count
>
> while count < 10:
> print "Hello, I am a while and count is", count
>count += 1
>
On 27/11/2017 12:54, Cai Gengyang wrote:
>
> Input :
>
> count = 0
>
> if count < 5:
>print "Hello, I am an if statement and count is", count
>
> while count < 10:
>print "Hello, I am a while and count is", count
>count += 1
Cai Gengyang writes:
Statement 0:
>count = 0
Statement 1:
>if count < 5:
> print "Hello, I am an if statement and count is", count
Statement 2:
>while count < 10:
> print "Hello, I am a while and count is", count
> count += 1
There are
On 11/27/17 7:54 AM, Cai Gengyang wrote:
Input :
count = 0
if count < 5:
print "Hello, I am an if statement and count is", count
while count < 10:
print "Hello, I am a while and count is", count
count += 1
Output :
Hello, I am an if statement and count is
On 27/11/2017 12:54, Cai Gengyang wrote:
Input :
count = 0
if count < 5:
print "Hello, I am an if statement and count is", count
while count < 10:
print "Hello, I am a while and count is", count
count += 1
Output :
Hello, I am an if statement and count is
Input :
count = 0
if count < 5:
print "Hello, I am an if statement and count is", count
while count < 10:
print "Hello, I am a while and count is", count
count += 1
Output :
Hello, I am an if statement and count is 0
Hello, I am a while and count is 0
Hello, I
Andre Müller wrote:
> # to impress your friends you can do
> for chunk in itertools.zip_longest(*[iter(s)]*4):
> chunked_str = ''.join(c for c in chunk if c) # generator expression
> inside join with condition
> print(chunked_str)
This can be simplified with a fillvalue
>>> s = "abracad
Am 15.06.2017 um 07:09 schrieb Jussi Piitulainen:
> Andre Müller writes:
>
>> I'm a fan of infinite sequences. Try out itertools.islice.
>> You should not underestimate this very important module.
>>
>> Please read also the documentation:
>> https://docs.python.org/3.6/library/itertools.html
>>
>>
Andre Müller writes:
> I'm a fan of infinite sequences. Try out itertools.islice.
> You should not underestimate this very important module.
>
> Please read also the documentation:
> https://docs.python.org/3.6/library/itertools.html
>
> from itertools import islice
>
> iterable = range(10
I'm a fan of infinite sequences. Try out itertools.islice.
You should not underestimate this very important module.
Please read also the documentation:
https://docs.python.org/3.6/library/itertools.html
from itertools import islice
iterable = range(100)
# since Python 3 range is a lazy e
Thank you Peter and Jussi - both your solutions were very helpful!
Malcolm
--
https://mail.python.org/mailman/listinfo/python-list
Malcolm Greene writes:
> Wondering if there's a standard lib version of something like
> enumerate() that takes a max count value?
> Use case: When you want to enumerate through an iterable, but want to
> limit the number of iterations without introducing if-condition-break
Malcolm Greene wrote:
> Wondering if there's a standard lib version of something like
> enumerate() that takes a max count value?
> Use case: When you want to enumerate through an iterable, but want to
> limit the number of iterations without introducing if-condition-break
Wondering if there's a standard lib version of something like
enumerate() that takes a max count value?
Use case: When you want to enumerate through an iterable, but want to
limit the number of iterations without introducing if-condition-break
blocks in code.
Something like:
for counter, k
On Sat, 29 Apr 2017 22:05:16 +, Robert L. wrote:
>> Task
>>
>> Write a program which counts up from 1, displaying each number as the
>> multiplication of its prime factors.
>>
>> For the purpose of this task, 1 (unity) may be shown as itself.
>>
>>
>> Example
>>
>>2 is prime, so i
tell your proposal to count
--
https://mail.python.org/mailman/listinfo/python-list
On Sun, 29 Jan 2017 11:42:47 -0800 (PST), Xristos Xristoou wrote:
> i tried to count points from the point shapefile where is within in
> the polygon shapefile but i fail.Maybe my code is complete wrong but i
> tried.
> any idea how to fix my code ?
> i want fast method because
i tried to count points from the point shapefile where is within in the polygon
shapefile but i fail.Maybe my code is complete wrong but i tried.
any idea how to fix my code ?
i want fast method because i have big data features
from shapely.geometry import shape
import fiona
filepath1
On 3/31/2016 11:44 PM, DFS wrote:
import pyodbc
dbName = "D:\test_data.mdb"
conn = pyodbc.connect('DRIVER={Microsoft Access Driver
(*.mdb)};DBQ='+dbName)
cursor = conn.cursor()
#COUNT TABLES, LIST COLUMNS
tblC
import pyodbc
dbName = "D:\test_data.mdb"
conn = pyodbc.connect('DRIVER={Microsoft Access Driver
(*.mdb)};DBQ='+dbName)
cursor = conn.cursor()
#COUNT TABLES, LIST COLUMNS
tblCount = 0
for rows in cursor.
Thank you very much for the help.
First I want count by city and year.
City year count
Xc1.2001. 1
Xc1.2002. 3
Yv1. 2001. 1
Yv2.2002. 4
This worked fine !
Now I want to count by city only
City. Count
Xc1. 4
Yv2. 5
Then combine these two objects with the original data and
alf Of
Val Krem via Python-list
Sent: 09 March 2016 21:31
To: python-list@python.org
Subject: Read and count
Hi all,
I am a new learner about python (moving from R to python) and trying read and
count the number of observation by year for each city.
The data set look like
city year x
XC1 200
Jussi Piitulainen wrote:
> Val Krem writes:
>
>> Hi all,
>>
>> I am a new learner about python (moving from R to python) and trying
>> read and count the number of observation by year for each city.
>>
>>
>> The data set look like
>> ci
Hello and welcome.
Please see my comments below.
On 09/03/2016 21:30, Val Krem via Python-list wrote:
Hi all,
I am a new learner about python (moving from R to python) and trying read and
count the number of observation by year for each city.
The data set look like
city year x
XC1 2001
Val Krem writes:
> Hi all,
>
> I am a new learner about python (moving from R to python) and trying
> read and count the number of observation by year for each city.
>
>
> The data set look like
> city year x
>
> XC1 2001 10
> XC1 2001 20
> XC1 2002
Hi all,
I am a new learner about python (moving from R to python) and trying read and
count the number of observation by year for each city.
The data set look like
city year x
XC1 2001 10
XC1 2001 20
XC1 2002 20
XC1 2002 10
XC1 2002 10
Yv2 2001 10
Yv2 2002 20
Yv2 2002
On Sunday, November 29, 2015 at 9:51:46 PM UTC-5, Laura Creighton wrote:
> In a message of Sun, 29 Nov 2015 21:31:49 -0500, Cem Karan writes:
> >You might want to look into Beautiful Soup
> >(https://pypi.python.org/pypi/beautifulsoup4), which is an HTML
> >screen-scraping tool. I've never used
On Sunday, November 29, 2015 at 7:49:40 PM UTC-5, ryguy7272 wrote:
> I'm trying to figure out how to count words in a web site. Here is a sample
> of the link I want to scrape data from and count specific words.
> http://finance.yahoo.com/q/h?s=STRP+Headlines
>
> I only w
> On 30 Nov 2015, at 03:54, ryguy7272 wrote:
>
> Now, how can I count specific words like 'fraud' and 'lawsuit'?
- convert the page to plain text
- remove any interpunction
- split into words
- see what words occur
- enumerate all the words and increase a counter
> Good luck,
> Cem Karan
>
> On Nov 29, 2015, at 7:49 PM, ryguy7272 wrote:
>
> > I'm trying to figure out how to count words in a web site. Here is a
> > sample of the link I want to scrape data from and count specific words.
> > http://finance.yahoo.com/q/h?s=S
In a message of Sun, 29 Nov 2015 21:31:49 -0500, Cem Karan writes:
>You might want to look into Beautiful Soup
>(https://pypi.python.org/pypi/beautifulsoup4), which is an HTML
>screen-scraping tool. I've never used it, but I've heard good things about it.
>
>Good luck,
>Cem Karan
http://coderev
figure out how to count words in a web site. Here is a sample
> of the link I want to scrape data from and count specific words.
> http://finance.yahoo.com/q/h?s=STRP+Headlines
>
> I only want to count certain words, like 'fraud', 'lawsuit', etc. I want to
> have
I'm trying to figure out how to count words in a web site. Here is a sample of
the link I want to scrape data from and count specific words.
http://finance.yahoo.com/q/h?s=STRP+Headlines
I only want to count certain words, like 'fraud', 'lawsuit', etc. I want to
On 6/22/2015 9:32 PM, Paul Rubin wrote:
Travis Griggs writes:
The following seems to obtuse/clever for its own good:
return sum(1 for _ in self.path.iterdir())
I disagree. For one who understands counting and Python, this is a
direct way to define the count of a finite iterable. A
Travis Griggs wrote:
> Subject nearly says it all.
>
> If i’m using pathlib, what’s the simplest/idiomatic way to simply count
> how many files are in a given directory?
>
> I was surprised (at first) when
>
> len(self.path.iterdir())
>
> I don’t say anythin
1 - 100 of 532 matches
Mail list logo