Re: [Tutor] Quote and double quotes opens up File Explorer in Windows 10 (RESOLVED)
On 07/09/2016 01:02 PM, eryk sun wrote: On Sat, Jul 9, 2016 at 2:22 PM, Ken G.wrote: Hi: In gradually moving over my Python programs (2.7.6) to Windows 10 and using Geany 1.27 to modify or write up a program there, it is noted that whenever I typed in a quote (') or double quote ("), Windows 10 File Explorer opens up. I end up closing it by typing ALT-F4 to resume typing as before. Is there a way to prevent the File Explorer from opening up whenever I use a quote or double quote? Is there another key(s) that does weird thing in Windows 10? Thanks. The single/double quote key isn't a standard hotkey in any version of Windows. That would be insane. If this is just happening in Geany, check its keybindings preferences. Otherwise, check that you're using the right keyboard layout and that you don't have any programs (or malware) that's registering a global hotkey. For example, here's a simple script that registers the single quote (US keyboard layout) as a global hotkey to open the desktop in Explorer: #! /usr/bin/python3 import os import ctypes from ctypes import wintypes user32 = ctypes.WinDLL('user32') WM_HOTKEY = 0x0312 MOD_NOREPEAT = 0x4000 VK_OEM_7 = 0xDE # US layout, single/double quote hotkey_id = 1 if user32.RegisterHotKey(None, hotkey_id, MOD_NOREPEAT, VK_OEM_7): print('Hotkey "\'" registered.') msg = wintypes.MSG() count = 0 while (count < 3 and user32.GetMessageW(ctypes.byref(msg), None, 0, 0)): if msg.message == WM_HOTKEY and msg.wParam == hotkey_id: count += 1 print('Hotkey received.') os.startfile('shell:Desktop') Thank you for the responses. As it just turned out, it was the keyboard sending out a faulty signal for the quote and double quote to the computer. I switched keyboard and there was no opening of the File Explorer when sending quote and double quote using Geany. Again, thanks. Ken ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Counting and grouping dictionary values in Python 2.7
On Fri, Jul 8, 2016 at 1:33 PM, Alan Gauld via Tutorwrote: > On 08/07/16 14:22, Bruce Dykes wrote: > > > with it is writing the list of dictionaries to a .csv file, and to date, > > we've been able to get by doing some basic analysis by simply using grep > > and wc, but I need to do more with it now. > > I'm a big fan of using the right tool for the job. > If you got your data in CSV have you considered using a > spreadsheet to read the data and analyse it? They have lots > of formulae and stats functions built in and can do really > cool graphs etc and can read csv files natively. > > Python might be a better tool if you want regular identical reports, say > on a daily basis, but for ad-hoc analysis, or at least till you know > exactly what you need, Excel or Calc are possibly better tools. > > > We can and have used spreadsheets for small ad-hoc things, but no, we need two things, first, as noted, a daily report with various basic analyses, mainly totals, and percentages, and second, possibly, some near-current alarm checks, depending. That's less important, actually, but it might be a nice convenience. In the first instance, we want the reports to be accessed and displayed as web pages. Now, likewise, I'm sure there's a CMS that might make semi-quick work of this as well, but really, all I need to do is to display some web pages and run some cgi scripts. bkd ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] 10+ Different Python Script?
> On Jul 13, 2016, at 8:03 AM, Crusierwrote: > > Dear All, > > I am currently using: > Python 3.5 > Window 7 > > > I have a python script which is used for downloading Real Time Stocks. > Currently, there is over a 1000 stocks in the Portfolio. > > If I download the market info during market hours, it would take over > 40 minutes to finish downloading all the market info. Since I am Do you know where this (seeming) throughput limitation is _actually_ occurring? I don’t know what format you are getting the data in, but if each stock is represented by it’s 1-4 character symbol, followed by a current quote (perhaps both bid and asked), then this adds up to around a dozen characters. Lets be generous and say 20 bytes. Twenty bytes times 1000 stocks is 20 kB. Even a “slow” connection these days should give you a 2 Mbs throughput or 200 kBs (including overhead), so your 20 kB of data should download in roughly one tenth of a second. > trading stock real time, I am thinking of breaking it down into 100 > stocks per group, so I could make the download time shorter. For the > market info, I will put into database and for data analysis. > In other words, don’t waste time solving the wrong problem. > My Question is as follows: > > Please advise if I should put the portfolio and split it into 10 > different scripts, so each scripts consists a list of 100+ number of > stocks. Or is there any Pythonic way to approach this problem?? > > I am currently using Multi Thread but there is an Operational Error > > > I am having a hard time to approach OOP. I just can't grasp the > understanding of it as it seems so abstract. Please advise. > > Thank you > > Regards, > Hank > ___ > 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: 10+ Different Python Script?
On Wed, Jul 13, 2016 at 05:03:41AM -0700, Crusier wrote: > I have a python script which is used for downloading Real Time Stocks. > Currently, there is over a 1000 stocks in the Portfolio. > > If I download the market info during market hours, it would take over > 40 minutes to finish downloading all the market info. That's only 2.4 seconds per stock. Depending on how much data each stock provides, that doesn't sound like much time to me. (1) How much data is downloaded? Perhaps you are downloading as fast as your internet conection will allow. (2) How long does it take to download outside of market hours? Perhaps the supplier throttles the speed that you can download during market hours, or perhaps they're just overloaded with requests and can't supply information any faster. > Since I am > trading stock real time, I am thinking of breaking it down into 100 > stocks per group, so I could make the download time shorter. Why do you think that downloading 10*100 stocks will take less time than downloading 1000 stocks? Either way, you still have to download the same amount of information. > For the > market info, I will put into database and for data analysis. > > My Question is as follows: > > Please advise if I should put the portfolio and split it into 10 > different scripts, so each scripts consists a list of 100+ number of > stocks. Or is there any Pythonic way to approach this problem?? Absolutely not. You shouldn't have the portfolio inside the script. You should have one script, and ten portfolios. Then you give the name of the portfolio as an argument to the script: myscript.py portfolio1 myscript.py portfolio2 myscript.py portfolio3 ... myscript.py portfolio10 or possibly: myscript.py portfolio1 portfolio2 portfolio3 ... portfolio10 > I am currently using Multi Thread but there is an Operational Error What sort of error? > I am having a hard time to approach OOP. I just can't grasp the > understanding of it as it seems so abstract. Please advise. One related question per email please. It makes it easier to follow the conversations if you put unrelated questions in different emails. -- Steve ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
[Tutor] Fwd: 10+ Different Python Script?
Dear All, I am currently using: Python 3.5 Window 7 I have a python script which is used for downloading Real Time Stocks. Currently, there is over a 1000 stocks in the Portfolio. If I download the market info during market hours, it would take over 40 minutes to finish downloading all the market info. Since I am trading stock real time, I am thinking of breaking it down into 100 stocks per group, so I could make the download time shorter. For the market info, I will put into database and for data analysis. My Question is as follows: Please advise if I should put the portfolio and split it into 10 different scripts, so each scripts consists a list of 100+ number of stocks. Or is there any Pythonic way to approach this problem?? I am currently using Multi Thread but there is an Operational Error I am having a hard time to approach OOP. I just can't grasp the understanding of it as it seems so abstract. Please advise. Thank you Regards, Hank ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor