Re: [Tutor] Where is win32print in Windows 10 Pro

2016-08-13 Thread Ken G.
On 08/12/2016 11:56 PM, eryk sun wrote: On Thu, Aug 11, 2016 at 2:44 PM, Joaquin Alzola wrote: import win32print ImportError: No module named win32print That module doesn't exist on your python path 'pywin32' is its canonical name. http://sourceforge.net/projects/pywin32/ I'm not certain w

Re: [Tutor] Where is win32print in Windows 10 Pro [RESOLVED]

2016-08-11 Thread Ken G.
On 08/11/2016 01:19 PM, Alan Gauld via Tutor wrote: On 11/08/16 17:14, Ken G. wrote: Unfortunately, no printing is done yet. Still working on it. Your reference to duckduckgo.com provided a list of useful pywin32 attibutes but no examples was provided. Will keep looking. Thanks. PyWin32 is a

Re: [Tutor] Where is win32print in Windows 10 Pro [RESOLVED]

2016-08-11 Thread Ken G.
On 08/11/2016 11:34 AM, Steven D'Aprano wrote: On Thu, Aug 11, 2016 at 10:28:44AM -0400, Ken G. wrote: import win32print ImportError: No module named win32print I have searched high and low within my Windows computer and have been unable to find '

[Tutor] Where is win32print in Windows 10 Pro

2016-08-11 Thread Ken G.
Currently in my Windows 10 Pro, 64-bit operating system, x64-bit based processor, using Python-2.7.12.amd64, I have for the first few lines: ``` import os, sys import win32print ` and get the following error message: `

[Tutor] Program won't print out in Windows 10

2016-07-24 Thread Ken G.
While the following program prints out fine using Python 2.7.6 in Ubuntu 14.04.4 as developed using Geany 1.23.1, same program won't print out to printer under Windows 10 Pro (64 bit). Geany uses there is version 1.28 using Python 2.7.12. I can use CTRL-P to print out the listing. ==

Re: [Tutor] Quote and double quotes opens up File Explorer in Windows 10 (RESOLVED)

2016-07-13 Thread Ken G.
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 ("

[Tutor] Quote and double quotes opens up File Explorer in Windows 10

2016-07-09 Thread Ken G.
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 bef

Re: [Tutor] Sorting a list in ascending order [RESOLVED]

2016-04-29 Thread Ken G.
On 04/29/2016 07:40 PM, Alan Gauld via Tutor wrote: On 29/04/16 23:58, Ken G. wrote: print ''.join(list1) #making it again as a single string Thanks, Meena, that is great! I changed your last line to: print "".join(list1) and it came out as below: 051141445

Re: [Tutor] Sorting a list in ascending order [RESOLVED]

2016-04-29 Thread Ken G.
On 04/29/2016 05:10 PM, Martin A. Brown wrote: Greetings Ken and welcome to Python, Using Linux 2.7.6 in Ubuntu 14.04.4. Thanks. Thank you for this information. I have one tip for you: While Python 2.x will still be around for a while, if you are learning Python today, I'd suggest Python 3

Re: [Tutor] Sorting a list in ascending order [RESOLVED]

2016-04-29 Thread Ken G.
On Fri, Apr 29, 2016 at 3:01 PM, Ken G. <mailto:beachkid...@gmail.com>> wrote: In entering five random number, how can I best sort it into ascending order, such as 0511414453? Using Linux 2.7.6 in Ubuntu 14.04.4. Thanks. number01 = "41" number02 = &quo

[Tutor] Sorting a list in ascending order

2016-04-29 Thread Ken G.
In entering five random number, how can I best sort it into ascending order, such as 0511414453? Using Linux 2.7.6 in Ubuntu 14.04.4. Thanks. number01 = "41" number02 = "11" number03 = "05" number04 = "53" number05 = "44" line = number01 + number02 + number03 + number04 + number05 print print lin

Re: [Tutor] Best way to install Python 3 onto Windows 10 [RESOLVED]

2016-03-15 Thread Ken G.
On 03/15/2016 05:45 PM, Alan Gauld wrote: On 15/03/16 21:31, Ken G. wrote: Having acquired a new laptop yesterday with Windows 10 installed and up-to-date, what would be the best way to install the latest version of Python 3? Personally I always install ActiveState Python on Windows so that I

[Tutor] Best way to install Python 3 onto Windows 10

2016-03-15 Thread Ken G.
Having acquired a new laptop yesterday with Windows 10 installed and up-to-date, what would be the best way to install the latest version of Python 3? The laptop is an Dell Latitude E5500 and I am still learning the bells and whistles of it. I last used Windows XP 3-4 years back so this usage is a

Re: [Tutor] Recommendations for best tool to write/run Python

2016-03-02 Thread Ken G.
On 03/02/2016 01:26 PM, Lisa Hasler Waters wrote: Hello everyone, I am new to Python, as are my middle school students. We are using Python 3.5.1 IDLE to write and run our (simple) code. However, this tool does not seem to be the best way to write longer code or to be able to re-edit code that

Re: [Tutor] Unable to get out of loop [RESOLVING]

2016-02-27 Thread Ken G.
On 02/26/2016 09:26 PM, Steven D'Aprano wrote: On Fri, Feb 26, 2016 at 08:30:19PM -0500, Ken G. wrote: side = "" while side != "0" or side != "1" or side != "2": That will only exit if side == "0", "1" and "2" **at t

[Tutor] Unable to get out of loop

2016-02-26 Thread Ken G.
I have been unable to get out of the following loop. No matter what I entered, I can not get get out of the loop. The only way I can stop the routine is CTRL-C. If an entry is either 1, 2 or 3, then I should be able to proceed. I am sure the correct solution is very simple but I don't see it. Th

Re: [Tutor] OT: Searching Tutor Archives

2015-08-19 Thread Ken G.
On 08/19/2015 07:34 PM, Alan Gauld wrote: On 19/08/15 18:43, Ken G. wrote: explain how to found such an article or kindly refresh my memory on how to correct an original file without using a secondary file. Thanks. Others have explained the search. Let me just point out that the number of

Re: [Tutor] OT: Searching Tutor Archives

2015-08-19 Thread Ken G.
On 08/19/2015 06:09 PM, Ben Finney wrote: "Ken G." writes: Could someone explain how to found such an article At the end of every message to this forum you'll see this footer: ___ Tutor maillist - Tutor@python.org To unsubs

[Tutor] OT: Searching Tutor Archives

2015-08-19 Thread Ken G.
While searching in Google several months ago, I came across a response addressed to me regarding on how to read, correct and write to the same file at the same time without using a secondary file as a temporary file to hold the corrected entries and rewriting to the original file. The entry wa

Re: [Tutor] Reference last email message...

2015-04-16 Thread Ken G.
On 04/15/2015 08:21 PM, Alan Gauld wrote: On 16/04/15 00:47, Ken G. wrote: I just emailed that I was unable to correct a message in ModTools so I went to Yahoo and made the change and then approved it. What is ModTools? What kind of message? Where does Yahoo fit in? What does any of it

Re: [Tutor] Reference last email message...

2015-04-16 Thread Ken G.
On 04/15/2015 08:45 PM, Dave Angel wrote: On 04/15/2015 07:47 PM, Ken G. wrote: I just emailed that I was unable to correct a message in ModTools so I went to Yahoo and made the change and then approved it. Noticing it did not appear on the list, I checked the Activity Log in Yahoo and it

[Tutor] Reference last email message...

2015-04-15 Thread Ken G.
I just emailed that I was unable to correct a message in ModTools so I went to Yahoo and made the change and then approved it. Noticing it did not appear on the list, I checked the Activity Log in Yahoo and it was marked Bounced! Several days ago, we had another message correction and that too,

Re: [Tutor] Changing a string number to another number [RESOLVED]

2015-04-15 Thread Ken G.
On 04/15/2015 09:09 AM, Steven D'Aprano wrote: On Wed, Apr 15, 2015 at 08:21:33AM -0400, Ken G. wrote: When running the following code, I get the following error code: 201504110102030405061 Traceback (most recent call last): File "Mega_Millions_Tickets_Change.py&quo

Re: [Tutor] Changing a string number to another number [RESOLVED]

2015-04-15 Thread Ken G.
On 04/15/2015 08:50 AM, Peter Otten wrote: Ken G. wrote: When running the following code, I get the following error code: 201504110102030405061 Traceback (most recent call last): File "Mega_Millions_Tickets_Change.py", line 11, in datecode[20:21] = "0" Typ

Re: [Tutor] Changing a string number to another number [RESOLVED]

2015-04-15 Thread Ken G.
On 04/15/2015 08:36 AM, Dave Angel wrote: On 04/15/2015 08:21 AM, Ken G. wrote: When running the following code, I get the following error code: 201504110102030405061 Traceback (most recent call last): File "Mega_Millions_Tickets_Change.py", line 11, in datecode[2

[Tutor] Changing a string number to another number

2015-04-15 Thread Ken G.
When running the following code, I get the following error code: 201504110102030405061 Traceback (most recent call last): File "Mega_Millions_Tickets_Change.py", line 11, in datecode[20:21] = "0" TypeError: 'str' object does not support item assignment datecode = "201504110102030405061"

Re: [Tutor] Function not returning 05 as string [SOLVED]

2015-04-13 Thread Ken G.
On 04/13/2015 08:56 AM, Steven D'Aprano wrote: On Mon, Apr 13, 2015 at 08:11:46AM -0400, Ken G. wrote: I am sure there is an simple explanation but when I input 5 (as integer), resulting in 05 (as string), I get zero as the end result. When running the code: number01 = 0 Here you se

Re: [Tutor] Function not returning 05 as string

2015-04-13 Thread Ken G.
On 04/13/2015 08:18 AM, Dave Angel wrote: On 04/13/2015 08:11 AM, Ken G. wrote: I am sure there is an simple explanation but when I input 5 (as integer), resulting in 05 (as string), I get zero as the end result. When running the code: START OF PROGRAM: Enter the 1st number: 5 05 0 END OF

[Tutor] Function not returning 05 as string

2015-04-13 Thread Ken G.
I am sure there is an simple explanation but when I input 5 (as integer), resulting in 05 (as string), I get zero as the end result. When running the code: START OF PROGRAM: Enter the 1st number: 5 05 0 END OF PROGRAM: START OF CODE: import sys def numberentry(): print number01 = raw

Re: [Tutor] Rearranging a list of numbers with corresponding index (RESOLVED)

2015-03-13 Thread Ken G.
On 03/13/2015 10:38 AM, Dave Angel wrote: On 03/13/2015 09:57 AM, Ken G. wrote: I have been keeping track of numbers drawn in our local lotto drawings into a list format as shown in a short example below. Using such list, I am able to determine how often a number appears within the last 100

Re: [Tutor] Rearranging a list of numbers with corresponding index

2015-03-13 Thread Ken G.
On 03/13/2015 10:21 AM, Peter Otten wrote: Ken G. wrote: I have been keeping track of numbers drawn in our local lotto drawings into a list format as shown in a short example below. Using such list, I am able to determine how often a number appears within the last 100 plus drawings. The

[Tutor] Rearranging a list of numbers with corresponding index

2015-03-13 Thread Ken G.
I have been keeping track of numbers drawn in our local lotto drawings into a list format as shown in a short example below. Using such list, I am able to determine how often a number appears within the last 100 plus drawings. The length of my lists range from 5, 15, 35, 59and 75 long. I will

Re: [Tutor] Rearranging a list

2015-02-26 Thread Ken G.
I may have mis-stated my intention. I will rewrite my request for assistance later and resubmit. Thanks, Ken On 02/26/2015 08:04 AM, Peter Otten wrote: Steven D'Aprano wrote: Ah wait, the penny drops! Now I understand what you mean! Glad I'm not the only one ;)

[Tutor] Rearranging a list

2015-02-26 Thread Ken G.
Assuming I have the following list and code how do I best be able rearrange the list as stated below: list = [0, 0, 21, 35, 19, 42] Using print list[2:6] resulted in the following: 221 335 419 542 I would like to rearrange the list as follow: 542 335 221 419

[Tutor] Old popen turned in subprocess...[SOLVED]

2015-02-17 Thread Ken G.
I wish to thanks Danny Yoo and Alan Gauld for providing information on using the new subprocess in printing on paper, replacing my old popen which was deprecated since Python 2.6. After some trial and errors, I got my desired output printed. Not looking forward to updating my old programs. Thank

Re: [Tutor] Popen was deprecated since Python 2.6, now what?

2015-02-16 Thread Ken G.
On 02/16/2015 06:26 PM, Alan Gauld wrote: On 16/02/15 21:26, Ken G. wrote: I have not been able to figure out on how to use a subprocess in place of my former popen. I have been reading the new materials on the subprocess all day and it is still not quite understandable. Here is what the

Re: [Tutor] Popen was deprecated since Python 2.6, now what?

2015-02-16 Thread Ken G.
On 02/16/2015 05:11 PM, Danny Yoo wrote: On Mon, Feb 16, 2015 at 1:26 PM, Ken G. wrote: Wow, just found out this morning that the following terms of: import os pr = os.popen("lpr", "w") pr.write(month), pr.write(" "), pr.write("\t\tLine ") was d

[Tutor] Popen was deprecated since Python 2.6, now what?

2015-02-16 Thread Ken G.
Wow, just found out this morning that the following terms of: import os pr = os.popen("lpr", "w") pr.write(month), pr.write(" "), pr.write("\t\tLine ") was deprecated. In place there of, there is a subprocess to use. I have not been able to figure out on how to use a subprocess in place of my f

[Tutor] RESOLVED: Re: Is there an easily or shorter way?

2014-12-16 Thread Ken G.
On 12/15/2014 07:47 PM, Danny Yoo wrote: Thank you but actually whatever number I get from either 1 to 28, each number represent a property name such as "Reading Railroad", "Judy Avenue", "Pacific Gas and Electric", etc., etc. For example: if x = 1 then print "Mediterranean Avenue" if x = 2 th

Re: [Tutor] Is there an easily or shorter way?

2014-12-15 Thread Ken G.
On 12/15/2014 05:59 PM, Dave Angel wrote: On 12/15/2014 04:25 PM, Ken G. wrote: I am sure there is a better way to refine the following lines. Letting x equal a number from 1 to 28, go through 28 separate 'if' statements to print a resulting value that equaled the value of x. For e

Re: [Tutor] Is there an easily or shorter way?

2014-12-15 Thread Ken G.
On 12/15/2014 05:49 PM, Steven D'Aprano wrote: On Mon, Dec 15, 2014 at 04:25:42PM -0500, Ken G. wrote: I am sure there is a better way to refine the following lines. Letting x equal a number from 1 to 28, go through 28 separate 'if' statements to print a resulting value that eq

Re: [Tutor] Is there an easily or shorter way?

2014-12-15 Thread Ken G.
On 12/15/2014 04:45 PM, Danny Yoo wrote: As a side note: if we were to talk about how we'd do this in a professional context, I think we'd recommend a library such as "humanize", which has functions to go from numbers to human-friendly string descriptions. https://pypi.python.org/pypi/huma

[Tutor] Is there an easily or shorter way?

2014-12-15 Thread Ken G.
I am sure there is a better way to refine the following lines. Letting x equal a number from 1 to 28, go through 28 separate 'if' statements to print a resulting value that equaled the value of x. For example: x = 8 if x = 1, print 'one' if x = 2, print 'two' ... ... if x = 8, print 'eight' ..

Re: [Tutor] eval use (directly by interpreter vs with in a script)

2014-11-03 Thread Ken G.
On 11/03/2014 12:37 AM, Danny Yoo wrote: I use exec to jump to another program within the same directory, such as: execfile("BloodPressure02Sorting.py") and let the program terminate there. Should I do it differently or are you talking about a different horse? This is related. Rather than u

Re: [Tutor] eval use (directly by interpreter vs with in a script)

2014-11-02 Thread Ken G.
On 11/02/2014 04:49 PM, Danny Yoo wrote: Hi Alex, Just as a side note, someone has probably already told you something like this, but: I would strongly recommend not to use Python's eval() or exec(). Those language features are dangerous. Every eval() or exec() is a possible vector for injec

Re: [Tutor] Error in printing out totalSystolic on paper (1018) [SOLVED]

2014-08-10 Thread Ken G.
Thanks you to the list for helping me solve my problem. I never had problem using and printing on paper "pr.write" in my coding until this latest one popped up. Yeah, this old dog is still learning new tricks here. LOL. Again, thanks. Ken ___ Tutor m

Re: [Tutor] Error in printing out totalSystolic on paper (1018)

2014-08-10 Thread Ken G.
On 08/10/2014 10:38 AM, Alex Kleider wrote: On 2014-08-10 06:41, Ken G. wrote: Receiving the following error from the terminal screen: Traceback (most recent call last): File "Blood Pressure05Print45.py", line 95, in pr.write(totalSystolic) TypeError: expected a character buf

[Tutor] Error in printing out totalSystolic on paper (1018)

2014-08-10 Thread Ken G.
Receiving the following error from the terminal screen: Traceback (most recent call last): File "Blood Pressure05Print45.py", line 95, in pr.write(totalSystolic) TypeError: expected a character buffer object Portion of strip: = pr.write (" "), pr.write (pulse), pr.write (

Re: [Tutor] Finding numeric day in a year...[SOLVED]

2014-06-28 Thread Ken G.
On 06/28/2014 04:35 PM, Mark Lawrence wrote: On 28/06/2014 19:39, Alan Gauld wrote: On 28/06/14 18:59, Ken G. wrote: BTW You say you get it from "database on file". Now if that is a real database such as SQLite you will find functions there to convert it to julian at source... which

Re: [Tutor] Finding numeric day in a year...[SOLVED]

2014-06-28 Thread Ken G.
On 06/28/2014 02:39 PM, Alan Gauld wrote: On 28/06/14 18:59, Ken G. wrote: datecode = "20140101" # from database on file month = datecode[4:6] day = datecode[6:8] year = datecode[0:4] use strptime() to parse dates, its much more reliable. datecode = year + "-" + mon

Re: [Tutor] Finding numeric day in a year...

2014-06-28 Thread Ken G.
On 06/28/2014 02:36 PM, Steven D'Aprano wrote: On Sat, Jun 28, 2014 at 01:59:04PM -0400, Ken G. wrote: I know the correct answer should be 001, but I keep getting 179 which is the correct answer for June 28, 2014 (I think). Day 179 of 2014 is June 28 according to my diary, which happens

Re: [Tutor] Finding numeric day in a year...

2014-06-28 Thread Ken G.
On 06/28/2014 02:20 PM, Albert-Jan Roskam wrote: From: Ken G. To: tutor@python.org Sent: Saturday, June 28, 2014 7:59 PM Subject: [Tutor] Finding numeric day in a year... I know the correct answer should be 001, but I keep getting 179 which is the correct

Re: [Tutor] Finding numeric day in a year...

2014-06-28 Thread Ken G.
On 06/28/2014 02:13 PM, Mark Lawrence wrote: On 28/06/2014 18:59, Ken G. wrote: I know the correct answer should be 001, but I keep getting 179 which is the correct answer for June 28, 2014 (I think). I tried using datecode in various places instead of today but I am still getting 179

[Tutor] Finding numeric day in a year...

2014-06-28 Thread Ken G.
I know the correct answer should be 001, but I keep getting 179 which is the correct answer for June 28, 2014 (I think). I tried using datecode in various places instead of today but I am still getting 179. Currently using Ubuntu 12.04.4 and Python 2.7. Thanks for any feedback and suggestion.

Re: [Tutor] most useful ide

2014-02-02 Thread Ken G.
On 02/02/2014 03:10 PM, Pierre Dagenais wrote: On 14-02-02 01:16 PM, Kodiak Firesmith wrote: Pycharm is nice for bigger projects (since tou can collapse any section); but it's crazy resource intensive. For Linux Gedit can be made very nice I prefer Geany as it will run my code with a click o

Re: [Tutor] Saving files in Python, IDE's & editors

2013-12-18 Thread Ken G.
For what it may be worth, I use Geany on my Ubuntu OS, 12.04 LTS. I also have IDLE installed and I can use the Terminal Window in running Command Line. Ken On 12/17/2013 09:28 PM, Keith Winston wrote: On Tue, Dec 17, 2013 at 7:26 PM, > wrote: What else do I

Re: [Tutor] Flip the coin 10x and count heads and tails: It works now!

2013-05-25 Thread Ken G.
On 05/25/2013 05:25 AM, Rafael Knuth wrote: Gents, thank you all for your help. One of you guys asked me to try out your suggestions and then tell you how it goes. Here we go! First, let me recap briefly what the expected outcome of my program was and which difficulties I encountered at the beg

Re: [Tutor] Python Idle Crashing

2013-05-17 Thread Ken G.
On 05/17/2013 02:19 PM, Alan Gauld wrote: On 17/05/13 18:16, bob gailer wrote: On 5/16/2013 8:49 PM, Alan Gauld wrote: don't run programs on real data using IDLE. IDLE is for developing programs not running them. That is really scary. Why do you say that? The IDLE documentation does NOT say

Re: [Tutor] Using a Blackjack Chart...

2012-05-24 Thread Ken G.
On 05/24/2012 10:27 AM, Prasad, Ramit wrote: There's no need for the 200lb sledgehammer of a database to crack this peanut. Thank you Steven for saving me from database hell. LOL. Yes, it would be a text based program. I will start working on this approach today. Again, my thanks. This wou

Re: [Tutor] Using a Blackjack Chart...

2012-05-24 Thread Ken G.
On 05/23/2012 09:36 PM, Steven D'Aprano wrote: Ken G. wrote: I would like to create a Python program in the manner of an using flash card format. That is, a question is asked and you can respond according and you will be notify if you are correct or incorrect. Is this supposed to

Re: [Tutor] sqlite3 question

2012-05-23 Thread Ken G.
On 05/23/2012 12:51 PM, Joel Goldstick wrote: On Wed, May 23, 2012 at 12:11 PM, Khalid Al-Ghamdi wrote: hi all, I'm using Python 3 and have read that you need sqlite to be installed to use the sqlite3 module, but when it is imported it seems to work ok. so, do you need to install it? also, w

Re: [Tutor] Using a Blackjack Chart...

2012-05-23 Thread Ken G.
On 05/23/2012 09:56 AM, Prasad, Ramit wrote: How can I best utilize such a chart in the Python program? Lists, Tuples, Dictionary or perhaps, a database format such as SQL? I tried using MySQLdb but was unable to use it since I am using Ubuntu 10.04.4 (Linux) as my main OS. My other OS is

[Tutor] Using a Blackjack Chart...

2012-05-22 Thread Ken G.
I would like to create a Python program in the manner of an using flash card format. That is, a question is asked and you can respond according and you will be notify if you are correct or incorrect. Using such format stated above, I would like to create a Blackjack program. I wish to utiliz

Re: [Tutor] Which should it be, lists, tuples, dictionary or files? [SOLVED]

2012-01-03 Thread Ken G.
On 01/03/2012 06:28 AM, Alan Gauld wrote: On 03/01/12 07:31, Devin Jeanpierre wrote: It's probably worth mentioning that shelve is not secure; loading a saved shelf can involve executing arbitrary python code embedded inside it. This probably isn't important for this particular project, but may

Re: [Tutor] Which should it be, lists, tuples, dictionary or files?

2012-01-02 Thread Ken G.
On 01/02/2012 05:47 PM, Steven D'Aprano wrote: Ken G. wrote: I have been using an Open Office Spreadsheet containing basically, the food name, basic serving amount, calories, sodium and carbohydrate. Daily, I entered the servicing amount being eaten and its calculate the amount of cal

[Tutor] Which should it be, lists, tuples, dictionary or files?

2012-01-02 Thread Ken G.
I have been using an Open Office Spreadsheet containing basically, the food name, basic serving amount, calories, sodium and carbohydrate. Daily, I entered the servicing amount being eaten and its calculate the amount of calories, sodium and carbohydrate. For some odd reason, I kept losing th

Re: [Tutor] Github Pygame Example Repository

2011-12-17 Thread Ken G.
The second link should be read as follow: http://flossstuff.wordpress.com/2011/12/17/github-repository-for-pygame-examples/ You had an extra period after http: Ken On 12/17/2011 01:00 PM, ANKUR AGGARWAL wrote: I have created an pygame example repo on github to promote the learning of this API

Re: [Tutor] Weird Error

2011-12-17 Thread Ken G.
On 12/17/2011 10:40 AM, Peter Otten wrote: Ken G. wrote: I have use 'sleep.time(5)' in most of my program but the following error is throwing me for a loss. import time Traceback (most recent call last): File "/home/ken/Python2/Blood Glucose/BloodGlucose04ReadingTimed.p

[Tutor] Weird Error

2011-12-17 Thread Ken G.
I have use 'sleep.time(5)' in most of my program but the following error is throwing me for a loss. import time Traceback (most recent call last): File "/home/ken/Python2/Blood Glucose/BloodGlucose04ReadingTimed.py", line 63, in time.sleep(2) AttributeError: 'str' object has no attribut

Re: [Tutor] File vs. Database (possible off topic)

2011-11-22 Thread Ken G.
On 11/22/2011 08:13 AM, Steven D'Aprano wrote: Ken G. wrote: It occurred to me last week while reviewing the files I made in using Python, it could be somewhat similar to a database. What would be a different between a Python files and Python databases? Granted, the access in creating

[Tutor] File vs. Database (possible off topic)

2011-11-21 Thread Ken G.
It occurred to me last week while reviewing the files I made in using Python, it could be somewhat similar to a database. What would be a different between a Python files and Python databases? Granted, the access in creating them are different, I really don't see any different in the format o

Re: [Tutor] [off-topic] Any thread for linux troubleshooting

2011-11-12 Thread Ken G.
On 12/11/11 17:54, Bikash Sahoo wrote: Can you please refer some threads for linux troubleshooting queries ?? Not so much a thread but the Ubuntu web forum is a good starting place and thereare tons of Linux news groups. Try a search on Google groups as your starting point. Also the Linux

Re: [Tutor] Beginning Python From Perl

2011-11-08 Thread Ken G.
Not necessary learning from Perl but I would recommend Alan Gauld's online website for learning Python from scratch: http://www.alan-g.me.uk/ Good luck in learning Python. Ken On 11/08/2011 05:14 PM, Jihad Esmail wrote: Hi! I am new to this list so stick with me. I've recentl

Re: [Tutor] Replying

2011-03-29 Thread Ken G.
I am using v3.1.8 for Mozilla Thunderbird. Ken On 03/28/2011 06:17 PM, Steven D'Aprano wrote: Corey Richardson wrote: Thunderbird has a "reply list" button that I use. It does? What version are you using? ___ Tutor maillist - Tutor@python.org

Re: [Tutor] New to programming

2011-03-18 Thread Ken G.
You may want to check out a short article entitled "Instant Hacking" by Magnus Lie Hetland. It is an introduction to programming using Python as an example. In the first paragraph thereby mentioned, there is a link to another easy article titled "Instant Python" written by the same author. H

Re: [Tutor] Python printing to LPT

2011-02-12 Thread Ken G.
On 02/12/2011 09:53 PM, Bill Allen wrote: Ken, Thanks for the great info on doing this on a Linux platform. I am sure I will be trying this with Linux sometime and I'll refer back to this. --Bill I discovered some more information on this at the following link: http://mail.python.org/

Re: [Tutor] Python printing to LPT

2011-02-12 Thread Ken G.
On 02/12/2011 10:14 AM, Bill Allen wrote: Is is possible to print directly to an LPT port printer from Python? --Bill I use the following format in my Ubuntu 10.04 usage. It set up a printing file. import os # declare values month = "02"; date = "11"; year = "2011" # open up fi

[Tutor] Sorting the Dictionary Set?

2010-07-06 Thread Ken G.
Is there a way to sort a dictionary? Assuming I have a dictionary set containing the following: {'02': 1, '03': 1, '12': 1, '15': 2, '14': 2, '04': 3, '05': 1, '19': 1, '32': 1, '28': 1, '27': 1, '17': 2, '25': 1} and using the following code: print ('Printing the result of numbers that

Re: [Tutor] Looking for duplicates within a list [SOLVED]

2010-06-11 Thread Ken G.
davidheise...@gmail.com wrote: How about this? List = [1, 2, 3, 3, 3, 4, 5, 5] for Item in list(set(List)): print Item, List.count(Item) - Original Message - *From:* Ken G. <mailto:beach...@insightbb.com> *To:* Steven D'Aprano <mailto:st...@pearwood

Re: [Tutor] Looking for duplicates within a list [SOLVED]

2010-06-11 Thread Ken G.
Hugo Arts wrote: On 11 jun 2010, at 17:49, Steven D'Aprano wrote: On Sat, 12 Jun 2010 12:58:19 am Alan Gauld wrote: Have you looked at the count method of lists? Something like: counts = set(( item, mylist.count(item)) for item in mylist if mylist.count(item) > 1) That's a

Re: [Tutor] Looking for duplicates within a list [SOLVED]

2010-06-11 Thread Ken G.
Steven D'Aprano wrote: On Sat, 12 Jun 2010 12:58:19 am Alan Gauld wrote: Have you looked at the count method of lists? Something like: counts = set(( item, mylist.count(item)) for item in mylist if mylist.count(item) > 1) That's a Shlemiel the Painter algorithm. http://www.joelons

Re: [Tutor] Looking for duplicates within a list [SOLVED]

2010-06-11 Thread Ken G.
Dave Angel wrote: Ken G. wrote: I have been working on this problem for several days and I am not making any progress. I have a group of 18 number, in ascending order, within a list. They ranged from 1 to 39. Some numbers are duplicated as much as three times or as few as none. I started

Re: [Tutor] Looking for duplicates within a list [SOLVED]

2010-06-11 Thread Ken G.
Alan Gauld wrote: "Ken G." wrote In any event, if a number is listed more than once, I would like to know how many times, such as 2 or 3 times. For example, '3' is listed twice within a list. Have you looked at the count method of lists? Something like:

Re: [Tutor] Looking for duplicates within a list [SOLVED]

2010-06-11 Thread Ken G.
Jose Amoreira wrote: On Friday, June 11, 2010 02:57:34 pm Ken G. wrote: I have been working on this problem for several days and I am not making any progress. I have a group of 18 number, in ascending order, within a list. They ranged from 1 to 39. Some numbers are duplicated as much as

Re: [Tutor] Looking for duplicates within a list [SOLVED]

2010-06-11 Thread Ken G.
Sander Sweers wrote: On 11 June 2010 15:57, Ken G. wrote: In any event, if a number is listed more than once, I would like to know how many times, such as 2 or 3 times. For example, '3' is listed twice within a list. If you do not have top keep the order of the number this

Re: [Tutor] Looking for duplicates within a list

2010-06-11 Thread Ken G.
Alex Hall wrote: On 6/11/10, Ken G. wrote: I have been working on this problem for several days and I am not making any progress. I have a group of 18 number, in ascending order, within a list. They ranged from 1 to 39. Some numbers are duplicated as much as three times or as few as none

Re: [Tutor] Looking for duplicates within a list

2010-06-11 Thread Ken G.
vijay wrote: Check out this code l= [1, 2, 3, 3, 4] d={} for item in l: d.setdefaut(item,0) d[item] +=1 print d {1: 1, 2: 1, 3: 2, 4: 1} with regard's vijay Thanks. Very interesting concept. Ken ___ Tutor maillist - Tutor@python.or

[Tutor] Looking for duplicates within a list

2010-06-11 Thread Ken G.
I have been working on this problem for several days and I am not making any progress. I have a group of 18 number, in ascending order, within a list. They ranged from 1 to 39. Some numbers are duplicated as much as three times or as few as none. I started with one list containing the numbe

Re: [Tutor] Finding duplicates entry in file

2010-03-20 Thread Ken G.
Thanks for letting me know. Corrective actions taken. Ken Luke Paireepinart wrote: On Sat, Mar 20, 2010 at 4:50 PM, Ken G. <mailto:beach...@insightbb.com>> wrote: Thanks for the info. I already adopted a program from another person and it works like a charm. As

Re: [Tutor] Finding duplicates entry in file

2010-03-20 Thread Ken G.
20, 2010 at 11:34 AM, Ken G. <mailto:beach...@insightbb.com>> wrote: What is a method I can use to find duplicated entry within a sorted numeric file? I was trying to read a file reading two lines at once but apparently, I can only read one line at a time. Can the

Re: [Tutor] Finding duplicates entry in file

2010-03-20 Thread Ken G.
Thanks! You gave me something to do for the rest of the afternoon. Ken Steven D'Aprano wrote: On Sun, 21 Mar 2010 03:34:01 am Ken G. wrote: What is a method I can use to find duplicated entry within a sorted numeric file? I was trying to read a file reading two lines at onc

[Tutor] Finding duplicates entry in file

2010-03-20 Thread Ken G.
What is a method I can use to find duplicated entry within a sorted numeric file? I was trying to read a file reading two lines at once but apparently, I can only read one line at a time. Can the same file be opened and read two times within a program? For example, a file has: 1 2 2 3 4 4

Re: [Tutor] First program

2010-03-13 Thread Ken G.
I am using Ubuntu 9.04 and I have versions 2.6.2 and 3.0.1+ installed. Look for IDLE in Add/Remove Applications. Perhaps, you may have a different version of Ubuntu. Ken Ray Parrish wrote: Yes, I'm using 2.45.2 as that is the highest version available in the Ubuntu repositories, and I'd l

Re: [Tutor] Changing the value in a list

2010-03-11 Thread Ken G.
Okay, I understand now. Thanks! Ken Steve Willoughby wrote: On Thu, Mar 11, 2010 at 10:32:45AM -0500, Ken G. wrote: list = ['physics', 'chemistry', 1997, 2000] This is a list of 4 elements, and lists allow elements to be changed, so list[2] = 2010

Re: [Tutor] Changing the value in a list

2010-03-11 Thread Ken G.
Okay, now, it is understood. Thanks. Ken Andre Engels wrote: On Thu, Mar 11, 2010 at 4:32 PM, Ken G. wrote: If the following program change list[2] to 2010, replacing 1997 (and it does), why doesn't the second program work in changing line[ 9:11] to 20 from 08? FIRST PROGRAM:

[Tutor] Changing the value in a list

2010-03-11 Thread Ken G.
If the following program change list[2] to 2010, replacing 1997 (and it does), why doesn't the second program work in changing line[ 9:11] to 20 from 08? FIRST PROGRAM: list = ['physics', 'chemistry', 1997, 2000] print list[2] list[2] = 2010 print list[2] OUTPUT: 1997 2010

Re: [Tutor] Bowing out

2010-03-03 Thread Ken G.
Thanks for helping out. I enjoyed readying your posts. Good luck on your future endeavors. Ken Kent Johnson wrote: Hi all, After six years of tutor posts my interest and energy have waned and I'm ready to move on to something new. I'm planning to stop reading and contributing to the list. I

[Tutor] Embarrassed...

2010-02-09 Thread Ken G.
I am a little embarrassed. I just happen to found a program I wrote in December that create random numbers into a file, copy the numbers into a list, print the numbers unsorted and sorted from the list without printing '\n'. Nevertheless, I do thanks you all for trying to help me out. Ken

Re: [Tutor] rstrip in list? (SOLVED)

2010-02-09 Thread Ken G.
ile.readlines(): print line.strip('\n'), mylist.append(line.strip('\n')) Further work and studying needed here. LOL. Ken Steven D'Aprano wrote: On Wed, 10 Feb 2010 02:28:43 am Ken G. wrote: I printed out some random numbers to a list and use 'print mylist&

Re: [Tutor] rstrip in list?

2010-02-09 Thread Ken G.
Kent Johnson wrote: On Tue, Feb 9, 2010 at 10:28 AM, Ken G. wrote: I printed out some random numbers to a datafile and use 'print mylist' and they came out like this: ['102\n', '231\n', '463\n', '487\n', '555\n', '961\n

  1   2   >