[Tutor] Hii

2019-06-20 Thread Antonio Arizpe
Hey ive looked everywhere and i would really appreciate the guidance
i know its not too complicated by google search results dodge my real
question


i just need help with a script thats registers keystrikes and adds up all
the times youve struck a key and gives a number of the total amount of
times the keyboard was struck. nothing specific about characters. just how
many times it was struck in a real number.

please any help would be greatly appreciated
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Hii

2019-06-20 Thread Alan Gauld via Tutor
On 19/06/2019 23:30, Antonio Arizpe wrote:

> i just need help with a script thats registers keystrikes and adds up all
> the times youve struck a key and gives a number of the total amount of
> times the keyboard was struck. nothing specific about characters. just how
> many times it was struck in a real number.

It is possible, but it will likely be OS specific so you need to
tell us which OS you are using/targeting.

Also any code that you've tried always helps along with any error
messages. Also tell us about any 3rd party libraries you are using.


-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


[Tutor] word printing issue

2019-06-20 Thread mhysnm1964
All,

 

I have a list of strings that I want to break them into separate words, and
a combination of words then store them into a list. Example below of a
string:

 

"Hello Python team".

 

The data structure:

 

[ ['Hello'],

['Hello', 'Python'],

['Hello', 'Python', 'team'],

]'Python'],

]'Python', 'team'],

['team'] ]

 

I want to know if there is a better method in doing this without the
requirement of a module. Eventually I want to count the number of hits in a
list of strings based upon the word combinations regardless where they are
located in the string. This last part is something I am struggling with to
get results that are correct. I have stored them in a dictionary and get
unexpected totals. Was thinking of using collection and still working on it.
If the above could be improved. I would be grateful.

 

Sean 

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] word printing issue

2019-06-20 Thread Alan Gauld via Tutor
On 20/06/2019 11:44, mhysnm1...@gmail.com wrote:

> I have a list of strings that I want to break them into separate words, and
> a combination of words then store them into a list. Example below of a
> string:

> "Hello Python team".
> The data structure:
> [ ['Hello'],
> ['Hello', 'Python'],
> ['Hello', 'Python', 'team'],
> ]'Python'],
> ]'Python', 'team'],
> ['team'] ]
> 
>  
> 
> I want to know if there is a better method in doing this without the
> requirement of a module. 

Modules are there to be used...

Here is one with itertools from the standard library that gets close:

input = "hello Python team".split()
result = []
for n in range(len(input):
   result += [item for item in it.combinations(input,n+1)]

If you really want to do it from scratch then Google combinations
algorithm, or look on wikipedia.

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Hii

2019-06-20 Thread David Rock

> On Jun 20, 2019, at 03:28, Alan Gauld via Tutor  wrote:
> 
> On 19/06/2019 23:30, Antonio Arizpe wrote:
> 
>> i just need help with a script thats registers keystrikes and adds up all
>> the times youve struck a key and gives a number of the total amount of
>> times the keyboard was struck. nothing specific about characters. just how
>> many times it was struck in a real number.
> 
> It is possible, but it will likely be OS specific so you need to
> tell us which OS you are using/targeting.
> 
> Also any code that you've tried always helps along with any error
> messages. Also tell us about any 3rd party libraries you are using.


Also, what’s the use case?  Do you want this to be something that is only 
capturing keystrokes within the program itself, or do you mean to capture all 
keystrokes happening regardless of application focus (i.e., system-level key 
logging)?


— 
David Rock
da...@graniteweb.com




___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


[Tutor] Fwd: Re: Hii

2019-06-20 Thread Alan Gauld via Tutor
Forwarding to list.
Please use Reply-All or Reply-List when responding to list emails.



 Forwarded Message 
Subject:Re: [Tutor] Hii
Date:   Thu, 20 Jun 2019 08:50:31 -0500
From:   Antonio Arizpe 
To: Alan Gauld 



i am using python 3.7

On Thu, Jun 20, 2019 at 8:43 AM Antonio Arizpe mailto:aarizpe...@gmail.com>> wrote:

it is for windows 7 64 bits but i will be targeting windows 7 and 10
32 and 64 bits

i currently use a script i was able to work together and its for
automated screenshots
i imagined for the key strike counter for it to be similar because i
imagined it as defining keystrikes as x = 1 and for every new key
strike would apply x+=1 and saving it in a text file in a directory.
im sorry im a little new for third party libraries im using im
really just using the default script that comes with python installation
to make example here is the code i use for automated screenshots

import sys
import os
from datetime import date
import pyautogui
import time
import shutil


today = str(date.today())

os.chdir ('C:\\Program Files\\Python37\\tll')
os.mkdir (today)


x=1
while x<1080:
pyautogui.screenshot('/Program
Files/Python37/tll/'+str(today)+'/image'+str(x)+'.png')
x+=1
time.sleep(30)

On Thu, Jun 20, 2019 at 3:30 AM Alan Gauld via Tutor
mailto:tutor@python.org>> wrote:

On 19/06/2019 23:30, Antonio Arizpe wrote:

> i just need help with a script thats registers keystrikes and
adds up all
> the times youve struck a key and gives a number of the total
amount of
> times the keyboard was struck. nothing specific about
characters. just how
> many times it was struck in a real number.

It is possible, but it will likely be OS specific so you need to
tell us which OS you are using/targeting.

Also any code that you've tried always helps along with any error
messages. Also tell us about any 3rd party libraries you are using.


-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


___
Tutor maillist?? -?? Tutor@python.org 
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Fwd: Re: Hii

2019-06-20 Thread Antonio Arizpe
On Thu, Jun 20, 2019 at 12:36 PM Alan Gauld via Tutor 
wrote:

> Forwarding to list.
> Please use Reply-All or Reply-List when responding to list emails.
>
>
>
>  Forwarded Message 
> Subject:Re: [Tutor] Hii
> Date:   Thu, 20 Jun 2019 08:50:31 -0500
> From:   Antonio Arizpe 
> To: Alan Gauld 
>
>
>
> i am using python 3.7
>
> On Thu, Jun 20, 2019 at 8:43 AM Antonio Arizpe  > wrote:
>
> it is for windows 7 64 bits but i will be targeting windows 7 and 10
> 32 and 64 bits
>
> i currently use a script i was able to work together and its for
> automated screenshots
> i imagined for the key strike counter for it to be similar because i
> imagined it as defining keystrikes as x = 1 and for every new key
> strike would apply x+=1 and saving it in a text file in a directory.
> im sorry im a little new for third party libraries im using im
> really just using the default script that comes with python
> installation
> to make example here is the code i use for automated screenshots
>
> import sys
> import os
> from datetime import date
> import pyautogui
> import time
> import shutil
>
>
> today = str(date.today())
>
> os.chdir ('C:\\Program Files\\Python37\\tll')
> os.mkdir (today)
>
>
> x=1
> while x<1080:
> pyautogui.screenshot('/Program
> Files/Python37/tll/'+str(today)+'/image'+str(x)+'.png')
> x+=1
> time.sleep(30)
>
> On Thu, Jun 20, 2019 at 3:30 AM Alan Gauld via Tutor
> mailto:tutor@python.org>> wrote:
>
> On 19/06/2019 23:30, Antonio Arizpe wrote:
>
> > i just need help with a script thats registers keystrikes and
> adds up all
> > the times youve struck a key and gives a number of the total
> amount of
> > times the keyboard was struck. nothing specific about
> characters. just how
> > many times it was struck in a real number.
>
> It is possible, but it will likely be OS specific so you need to
> tell us which OS you are using/targeting.
>
> Also any code that you've tried always helps along with any error
> messages. Also tell us about any 3rd party libraries you are using.
>
>
> --
> Alan G
> Author of the Learn to Program web site
> http://www.alan-g.me.uk/
> http://www.amazon.com/author/alan_gauld
> Follow my photo-blog on Flickr at:
> http://www.flickr.com/photos/alangauldphotos
>
>
> ___
> Tutor maillist?? -?? Tutor@python.org 
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
>
> ___
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
>
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] word printing issue

2019-06-20 Thread Steven D'Aprano
Hi Sean,

Your subject line says "word printing issue", but the body of your email 
says nothing about an issue printing words.

Have you tried print(word)?

Further comments and questions below.


On Thu, Jun 20, 2019 at 08:44:06PM +1000, mhysnm1...@gmail.com wrote:
> I have a list of strings that I want to break them into separate words, and
> a combination of words then store them into a list. Example below of a
> string:
> 
> "Hello Python team".
> 
> The data structure:
> 
> [ ['Hello'],
>   ['Hello', 'Python'],
>   ['Hello', 'Python', 'team'],
>   ['Python'],
>   ['Python', 'team'],
>   ['team'] ]


I've taken the liberty of correcting some obviouis typos in the data 
structure.


Sean wrote:

> I want to know if there is a better method in doing this without the
> requirement of a module.

Better than what? How are you doing it now?

Why don't you want to use a module?


Sean wrote:

> Eventually I want to count the number of hits in a
> list of strings based upon the word combinations regardless where they are
> located in the string. This last part is something I am struggling with to
> get results that are correct.

I'm struggling to understand what you mean. I don't understand what the 
word combinations part has to do with the problem.

If all you want to do is count each word, you could try this:

from collections import Counter
text = "Hello Python team"
c = Counter(text.split())
print(c)


which will print something like:

Counter({'team': 1, 'Python': 1, 'Hello': 1})

(the order of the counts may be different).


> I have stored them in a dictionary and get
> unexpected totals. 

Either your expectations are wrong, and the totals are correct, or your 
expectations are correct, and the code counting them is wrong.

Without knowing either your expectations or the code counting the 
totals, I cannot guess which is the case.


> Was thinking of using collection and still working on it.
> If the above could be improved. I would be grateful.

Without knowing what you are doing, it is hard to suggest improvements.

"Dear cooking experts, I'm baking a cake and it turned out all wrong. 
What can I do to make it better? Thanks in advance."



-- 
Steven
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor