[Tutor] a par2 creator and verification program

2019-07-23 Thread Adam Gold
Hello everyone. I'm thinking through a short program I want to write that will 'par2'/generate ECCs for all of my work files which branch out from a single directory and number approximately 15,000. Specifically: 1) day one: - create a mirror copy of the directory tree empty of all files (the

Re: [Tutor] graphics library for teaching Python

2018-12-21 Thread Adam Eyring
On Fri, Dec 21, 2018, 3:26 AM Michael Mossey wrote: > > There are two sub-topics I'm interested in - (1) graphics, as in drawing > interesting pictures or art, or using diagrams for data visualization. (2) > Simple games, with the use of sprites. > One that hasn't been mention in yours and Alan'

Re: [Tutor] Import CSV

2018-12-13 Thread Adam Eyring
Take a look at the book Automating the Boring Stuff with Python (free PDF): https://automatetheboringstuff.com/ There's a couple of chapters in there for downloading CSV files and extracting the data. On Thu, Dec 13, 2018 at 1:57 PM Sammy Lee wrote: > I need help on how to open a webpage and sa

Re: [Tutor] Any 'graphical' ways of learning Python

2018-12-05 Thread Adam Eyring
I've liked turtle and make my graphing more interesting by asking for user input such as dimensions, then graph automatically. One starter source for using pygame graphics is https://inventwithpython.com/pygame/ It jumps into game writing very quickly, but provides explanations of commands. The o

Re: [Tutor] Beginners Book, Python and PyScripter

2018-12-04 Thread Adam Eyring
I haven't gone through many python books, but have been using a copy of Automating the Boring Stuff with Python. It covers lists, dictionaries, scraping data from websites, etc. https://automatetheboringstuff.com/ The PDF is free. Adam On Tue, Dec 4, 2018 at 1:09 PM James Stapleton-Cotton

Re: [Tutor] Request for help with code

2018-11-07 Thread Adam Eyring
When I post code with questions, I just copy and paste from Python IDLE 3.6. Colors are removed, but indentation is preserved. On Tue, Nov 6, 2018 at 6:59 PM Mats Wichmann wrote: > On 11/6/18 4:36 PM, Joseph Gulizia wrote: > > Funny using a text editorand showed indented in my browser. >

Re: [Tutor] Installing python

2018-11-03 Thread Adam Eyring
On Fri, Nov 2, 2018 at 8:10 PM Mark Lawrence wrote: > On 02/11/2018 22:49, Alan Gauld via Tutor wrote: > > On 02/11/2018 21:13, Roger Lea Scherer wrote: > > > >> I have installed python 3.7 on my computer Windows10 > >> (C:\Users\Roger\AppData\Local\Programs\Python\Python37), > > > > Caveat: I'm

Re: [Tutor] Python Help

2018-10-26 Thread Adam Eyring
On Fri, Oct 26, 2018 at 3:03 PM Bob Gailer wrote: > On Oct 26, 2018 1:20 PM, "Adam Eyring" wrote: > > > > Try this cleaned up version with colons in the right places, dollar > signs removed, and other corrections: > > Does it do what you want? > > >

Re: [Tutor] Python Help

2018-10-26 Thread Adam Eyring
Try this cleaned up version with colons in the right places, dollar signs removed, and other corrections: beefmeals=int(input("Enter number of beef meals: ")) shitmeals=int(input("Enter number of vegan meals: ")) party = beefmeals + shitmeals print("Total meals", party) a = 0 b = 0 c = 0 if party

Re: [Tutor] Tutor Digest, Vol 176, Issue 13

2018-10-12 Thread Adam Eyring
Also, try (works for me in Python3) rivers = {'nile' : 'egypt', 'ohio' : 'US', 'rhine' : 'germany' } for key, value in rivers.items(): print (key) for key, value in rivers.items(): print (value) for key, value in rivers.items(): print ("The " + key + " is in the country of " + value)

Re: [Tutor] Help please

2018-10-12 Thread Adam Eyring
The program works as is in Python3. For Python2, change input to raw_input and see if that makes it work (I know it worked for me when I had Python2). Also, it looks better to use " + " instead of a comma: print("Combining these foods will you," + new_food) Also, colons and spaces are good practic

[Tutor] Pip issue

2018-10-05 Thread Adam Eyring
". I see there's get-pip.py, but the documentation on using it is confusing. Thanks for your help. Adam ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

[Tutor] Help

2018-07-03 Thread Adam Jones
", multipoint_size="0") # JOIN RandomFile (CID) to DonutFile (OBJECTID) arcpy.JoinField_management(in_data="RandomFile", in_field="CID", join_table="DonutFile", join_field="OBJECTID", fields="") # DELETE unnecessary fields in

Re: [Tutor] QT5 pyqt5 for python 2.7

2017-11-19 Thread adam ghering
Subject: Re: [Tutor] QT5 pyqt5 for python 2.7 On 18/11/17 01:51, adam ghering wrote: > Hello, > > I am trying to get up to speed on python; expand my skills etc. > > I work in a VFX environment where most all the tools continue to run with > python 2.7XX > > I have seen that p

[Tutor] QT5 pyqt5 for python 2.7

2017-11-18 Thread adam ghering
Hello, I am trying to get up to speed on python; expand my skills etc. I work in a VFX environment where most all the tools continue to run with python 2.7XX I have seen that pyqt5 supports python 2.7 according to its documentation but it needs to be rebuilt to function. I have done some

[Tutor] Need help with one problem.

2017-02-15 Thread Adam Howlett
Write an if-else statement that assigns 20 to the variable y if the variable x is greater than 100. Otherwise, it should assign 0 to the variable y. Is there an easy way to solve this problem? ___ Tutor maillist - Tutor@python.org To unsubscribe or ch

Re: [Tutor] print() invalid syntax error

2014-12-23 Thread Adam Jensen
On Tue, 23 Dec 2014 18:27:10 + stuart kurutac wrote: > finish = (int(input("Finish: ")) The parenthesis aren't balanced. I would have written it as: finish = int(input("Finish: ")) but something like this should also work: finish = (int(input("Finish: "))) ___

Re: [Tutor] My Query - How to implement multi threading with remote execution capability in python to achieve parallel processing

2014-12-23 Thread Adam Jensen
This thread is hilarious. Thanks for the chuckle. http://www.ignyte.ms/whitepapers/LayersOf%20HumanValuesInStrategy.pdf http://www.principiadiscordia.com/downloads/04%20Prometheus%20Rising.pdf On Mon, 22 Dec 2014 11:27:01 + Vishwas Pathak wrote: > I am working building on developing an au

Re: [Tutor] Learning to program, not code.

2014-12-21 Thread Adam Jensen
On Sun, 21 Dec 2014 21:15:43 +1100 Ben Finney wrote: > Use a distributed version control system > (Mercurial is good and is written in Python) I'm beginning to really appreciate [fossil](http://fossil-scm.org/). Re: "Learning to program, not code". Is that like learning to think rather than

Re: [Tutor] lottery problem (Was Re: (no subject))

2014-12-19 Thread Adam Jensen
On Fri, 19 Dec 2014 10:32:15 +0100 Peter Otten <__pete...@web.de> wrote: > Basically > > from random import randint, seed > > is equivalent to > > import random > randint = random.randint > seed = random.seed > del random > > From that you can deduce that the whole random module is loaded int

Re: [Tutor] lottery problem (Was Re: (no subject))

2014-12-18 Thread Adam Jensen
On Thu, 18 Dec 2014 20:27:03 -0500 Adam Jensen wrote: > And to build the 'lines' list (although, this is getting rather ugly): > > >>> lines = [[random.randint(x,x+6) for x in range(1,50,7)] for i in range(7)] Oops, in the context of the original program this might

Re: [Tutor] lottery problem (Was Re: (no subject))

2014-12-18 Thread Adam Jensen
On Fri, 19 Dec 2014 00:55:49 + Alan Gauld wrote: > You could have used a list instead of all the > individual variables > > line[0] = ... > line[1] = ... > > But then you could get clever and use a loop: > > while lines != 0: > start = 1 > period = 7 > for lineNum in range(7):

Re: [Tutor] Need help!

2014-12-13 Thread Adam Jensen
On Fri, 12 Dec 2014 07:46:05 -0500 Jagannath Ramanan wrote: > My name is jag. I need little bit of help understanding something. I have a > vncserver running at the background in redhat. My client is lubuntu where > im using python. > > For some reason the communication is only possible between

Re: [Tutor] Memory management in Python

2014-12-09 Thread Adam Jensen
On Wed, 26 Nov 2014 14:08:53 + Raúl Cumplido wrote: > This web is quite useful to visualize what is happening: > http://www.pythontutor.com/visualize.html#mode=edit > Very nifty web app, thanks for the link! ___ Tutor maillist - Tutor@python.org

[Tutor] pexpect interactive password entry for luks device

2014-11-24 Thread Adam Gold
I'm trying to do something really simply (I think) with pexpect but must be missing an obvious step. I want to ssh from host to guest, establish a CIFS connection on the guest to a share somewhere else on the local network, open a luks loop device on the share by entering the password (I don't wan

Re: [Tutor] Dividing a float derived from a string

2014-11-21 Thread Adam Jensen
> -Original Message- > From: Tutor [mailto:tutor-bounces+hanzer=riseup@python.org] On > Behalf Of Alan Gauld > Sent: Thursday, November 20, 2014 7:24 PM > But that's considered bad practice, it's better to put the valid errors only in > the except line like this: > > try: > print

Re: [Tutor] Dividing a float derived from a string

2014-11-20 Thread Adam Jensen
On Thu, 20 Nov 2014 21:20:27 + Stephanie Morrow wrote: > Hi there, > > I have been posed with the following challenge: > > "Create a script that will ask for a number. Check if their input is a > legitimate number. If it is, multiply it by 12 and print out the result." > > I was able to do

Re: [Tutor] Data chart

2014-11-20 Thread Adam Jensen
import fileinput def parseLine(a): x = a.split('/') b = x[1].split(':') c = b[0].split('.') y = c[0] z = int(b[2]) return x[0], y, z print('{:>4}{:>10}{:>8}{:>8}'.format('','canofica','lnvd','msd')) data = [0, 0, 0] prevDate = "None" for line in fileinput.input():

Re: [Tutor] Dividing a float derived from a string

2014-11-20 Thread Adam Jensen
#!/usr/bin/env python3.4 good = False s = input('Enter a number: ') a = s.split('.') n = len(a) if n <= 2: for y in a: if y.isdigit(): good = True else: good = False exit else: good = False if good: num = float(s) print(num * 12) e

Re: [Tutor] subprocess.Popen basics

2014-10-28 Thread Adam Jensen
On 10/28/2014 04:27 PM, Todd wrote: > Centos has SELinux enabled by default. I dont know if SELinux is > causing your problem, but it is always worth looking at. > > SELinux can keep a process from accessing files or executing another > process. > > Try temporarily disabling SELinux by runnin

Re: [Tutor] subprocess.Popen basics

2014-10-28 Thread Adam Jensen
On 10/28/2014 02:32 PM, Alan Gauld wrote: > I tried -1 and 1 on my Lubuntu and it still works fine. > Definitely weird, it begins to look like a CentOS build issue > but what is CentOS doing different to Lubuntu/Suse/OpenBSD etc? > > From memory CentOS is basically a free version of Red Hat > Ent

Re: [Tutor] subprocess.Popen basics

2014-10-28 Thread Adam Jensen
Update: On 10/27/2014 09:50 PM, Adam Jensen wrote: > What's weird is that I have two different python3.4 installations on > this CentOS-6.5 machine and both have the same behavior (script hangs > until Ctrl+C). > > I built this one (/opt/bin/python3.4) from source

Re: [Tutor] subprocess.Popen basics

2014-10-27 Thread Adam Jensen
On 10/27/2014 09:31 PM, Alan Gauld wrote: > On 27/10/14 20:26, Adam Jensen wrote: > >> That's a bit bizarre. I too have the execution bit set for both the >> python script and the shell script but the same (no joy) behavior occurs >> on both: > >> $ ./subpr

Re: [Tutor] subprocess.Popen basics

2014-10-27 Thread Adam Jensen
On 10/27/2014 03:40 PM, David Abbott wrote: >> It hangs at the print statement and, from the sound of the fans in the >> computer, I suspect it spirals off into an infinite loop somewhere / >> somehow. Does anyone have any ideas about what it is that I might be >> misunderstanding? > > Works here.

Re: [Tutor] subprocess.Popen basics

2014-10-27 Thread Adam Jensen
On 10/27/2014 07:12 PM, Alan Gauld wrote: > On 27/10/14 18:24, Adam Jensen wrote: >> It hangs at the print statement and, from the sound of the fans in the >> computer, I suspect it spirals off into an infinite loop somewhere > > It works fine on my Lubuntu 14 with Python3.4.

Re: [Tutor] subprocess.Popen basics

2014-10-27 Thread Adam Jensen
On 10/27/2014 03:40 PM, David Abbott wrote: >> It hangs at the print statement and, from the sound of the fans in the >> computer, I suspect it spirals off into an infinite loop somewhere / >> somehow. Does anyone have any ideas about what it is that I might be >> misunderstanding? > > Works here

[Tutor] subprocess.Popen basics

2014-10-27 Thread Adam Jensen
Hi, I'm exploring Popen today and I seem to be having some trouble deciphering the [documentation][1]. [1]: docs.python.org/3/library/subprocess.html#popen-constructor In this example (below), I expect to start a shell script as a separate process, send a line of text through a pipe (to the shell

Re: [Tutor] Standard Library Performance (3.4.1)

2014-10-24 Thread Adam Jensen
On 10/24/2014 08:01 AM, Stefan Behnel wrote: > Alan Gauld schrieb am 24.10.2014 um 13:03: >> Not all library modules are C based however so it doesn't >> always apply. But they are usually optimised and thoroughly >> debugged so it is still worth using them rather than building >> your own. > > I

[Tutor] Standard Library Performance (3.4.1)

2014-10-24 Thread Adam Jensen
I'm tinkering this evening and I've noticed that math.factorial() is much faster than my plain python implementations. import math def factorial(n): temp = 1 for k in range(0,n): temp = temp * (n - k) return(temp) def fac(n): r

Re: [Tutor] A question about using stdin/out/err vs named files

2014-10-19 Thread Adam Jensen
On 10/18/2014 02:36 PM, George R Goffe wrote: > Hi, > > When you run a python program, it appears that stdin, stdout, and stderr are > opened automatically. > > I've been trying to find out how you tell if there's data in stdin (like when > you pipe data to a python program) rather > than in a

Re: [Tutor] code review

2014-06-13 Thread Adam Gold
On 12/06/14 00:38, Alan Gauld wrote: > > HTH Thanks Alan and Lukáš for your very helpful comments. I will attempt to revise the script in light of them and will revert if I hit any brick walls :) ___ Tutor maillist - Tutor@python.org To unsubscribe

Re: [Tutor] code review

2014-06-11 Thread Adam Gold
n learn is by listening in to other people's > conversations - it's called lurking, I believe. > > So I would say, please do this on the list, and many more people than > Adam may benefit. Others can ignore the thread if they wish. > > Bob Oke doke, here it is below. Just for c

Re: [Tutor] code review

2014-06-11 Thread Adam Gold
On 11/06/14 00:04, Steven D'Aprano wrote: > On Tue, Jun 10, 2014 at 04:51:20PM +0100, Adam Gold wrote: >> Hi there. I've been writing a script that is now finished and working >> (thanks, in part, to some helpful input from this board). What I'd >> really lik

[Tutor] code review

2014-06-10 Thread Adam Gold
Hi there. I've been writing a script that is now finished and working (thanks, in part, to some helpful input from this board). What I'd really like to do now is go through it with an 'expert' who can point out ways I may have been able to code more efficiently/effectively. I don't think it woul

Re: [Tutor] gnupg within a for loop

2014-06-02 Thread Adam Gold
On 02/06/14 01:35, Danny Yoo wrote: >> Thanks Danny, that was spot on. I actually used os.chdir to change to >> the base directory (which I assigned to a variable) just before the open >> statement. I don't know if that's 'pythonically' correct but it seemed >> like a simple way to do it. Again,

Re: [Tutor] gnupg within a for loop

2014-06-02 Thread Adam Gold
On 01/06/14 18:28, Danny Yoo wrote: > Hi Adam, > > Ah; I've seen this before. Make sure the file name is either relative > to current working directory, or make the file name absolute. What's > happening is that os.listdir() is giving you file names that are > re

[Tutor] gnupg within a for loop

2014-06-01 Thread Adam Gold
e it would have to be inputted by the user). I start with the following which can be used to encrypt a single file (assume I have the indentations correct in the actual code, I can't seem to modify the wrapping with my email client): phrase = '12345' cipher = 'AES256' gp

Re: [Tutor] pipes and redirecting

2014-05-28 Thread Adam Gold
> On 27/05/14 21:01, Adam Gold wrote: > >> "dd if=/home/adam/1 bs=4k conv=noerror,notrunc,sync | pbzip2 > 1.img.bz2" >> >> The first thing I do is break it into two assignments > > And that's the start of the problem because it should be three:

[Tutor] pipes and redirecting

2014-05-27 Thread Adam Gold
I'm trying to run the following unix command from within Python as opposed to calling an external Bash script (the reason being I'm doing it multiple times within a for loop which is running through a list): "dd if=/home/adam/1 bs=4k conv=noerror,notrunc,sync | pbzip2 > 1.i

[Tutor] Python Help

2014-04-09 Thread Adam Grierson
Hi I'm using 3D climate data (ending in “.nc”). The cube contains time, longitude and latitude. I would like to look at the average output over the last 20 years. The time field spans back hundreds of years and I only know how to collapse the entire field into a mean value. How can I tell py

Re: [Tutor] Benefit/Disadvantage to storing data as dictionary vs. in a class

2012-06-01 Thread Adam
7;readings':[]} and having the Room class hold the update function; not so much from good programming practices, but more attempting to number of resources the class will be using. Thank you, Adam On 6/1/2012 10:24 AM, James Reynolds wrote: If you have functions (or in this case methods) w

[Tutor] Benefit/Disadvantage to storing data as dictionary vs. in a class

2012-06-01 Thread Adam
85][AVG]; however is this better/worse or the same as creating a 'Room' class to store the data? Since a 'Room' only contains a large amount of data, but doesn't contain any functions, which form of storing the data is considered 'better'? Thank you, Ada

Re: [Tutor] ssh socks proxy

2012-05-17 Thread Adam Gold
me script would look like if one used paramiko? On 17 May 2012, at 04:01, kushal.kumaran+pyt...@gmail.com wrote: kushal.kumaran+pyt...@gmail.com wrote: > Adam Gold wrote: > >> I'm trying to write a 'simple' script that will set up a socks proxy >> ove

[Tutor] ssh socks proxy

2012-05-16 Thread Adam Gold
I'm trying to write a 'simple' script that will set up a socks proxy over ssh and maintain the connection until manually terminated. It's not possible to use key-based authentication so a password will need to be supplied. Also, note, the user is presented with a list of servers to choose fro

Re: [Tutor] Extremely simple question

2012-01-11 Thread Adam Stogner
You should be using double quotes on this line and you are missing the last quote: print 'You're not Chris! Should be: print "You're not Chris!" On Wed, Jan 11, 2012 at 8:17 AM, col speed wrote: > On 11 January 2012 20:11, Max S. wrote: > > I believe that line 3 raises an error. The becaus

Re: [Tutor] different behaviour in Idle shell vs Mac terminal

2012-01-09 Thread Adam Gold
> Date: Sun, 8 Jan 2012 23:34:15 + > From: Adam Gold > To: > Subject: [Tutor] different behaviour in Idle shell vs Mac terminal > Message-ID: > Content-Type: text/plain; charset="iso-8859-1" > > > I have short piece of code I'm using to print a

[Tutor] different behaviour in Idle shell vs Mac terminal

2012-01-08 Thread Adam Gold
I have short piece of code I'm using to print a string to the terminal one letter at a time.  It works fine when I invoke the script from within Idle; each letter appears after the preceding one according to the designated time interval.  However if I run it in the Mac terminal ('python3 ./scri

Re: [Tutor] OT: Drag and Drop GUI IDE ideas

2011-07-28 Thread Adam Bark
presentation of your program as well as access to the source code of your application. It creates code for many different platforms including mobile ones and it's DRM free. HTH, Adam. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] serial device emulator

2011-07-05 Thread Adam Bark
oo.py ## import myserial as serial #import serial ## Use this in production port = serial.Serial() port.open() print port.write("hello, world") print port.read(3) I hope that makes it clearer to you. Adam. P.S. none of that code has been tested On 05/07/11 13:03, Edgar Almonte wrote:

[Tutor] Conceptual Question About Use of Python for Employee Training Program

2011-06-25 Thread Adam Carr
Good Morning: I am very new to Python but I am enjoying the learning process. I have a question about the application of Python to a problem at the industrial business where I work. My two main questions are: 1. Can Python be used to achieve the goals of the possible project? 2. Where are the

Re: [Tutor] Clunky Password maker

2011-05-25 Thread Adam Bark
On 25/05/11 19:54, Modulok wrote: Depending on what your passwords are going to be protecting, be aware that the default generator in the random module is: "...completely unsuitable for cryptographic purposes." If he's just planning on making a few passwords I think the period of 2**19937-1 of

[Tutor] Beginner needs help with tkinter and images

2011-05-17 Thread Adam Westrum
I've got a basic program going right now, with 4 buttons. Forward backward right and left. Each button goes to an image of a colored circle. Problem i'm having is that when you click a button, the picture appears. When you click another button, a different picture appears, but the first picture rem

Re: [Tutor] triple-nested for loop not working

2011-05-04 Thread Adam Lucas
On Wed, May 4, 2011 at 13:31, Spyros Charonis wrote: > Hello everyone, > > I have written a program, as part of a bioinformatics project, that > extracts motif sequences (programmatically just strings of letters) from a > database and writes them to a file. > I have written another script to anno

Re: [Tutor] after(), how do I use it?

2011-04-25 Thread Adam Bark
re still confused post it and hopefully we can clear it up for you. HTH, Adam. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] lambda

2011-03-19 Thread Adam Bark
s it many times. Map is another that works similarly. Have a look into functional programming as that's the branch of computer science those two functions and lambdas tend to come from I believe. http://docs.python.org/library/functions.html?highlight=lamb

Re: [Tutor] multiple if and or statement

2011-03-14 Thread Adam Bark
./testing.py true true true I know I am missing something, but in reality it should only print true once correct? Any string that isn't blank ie '' is true. In your test you've asked whether i == 'test1' is true or 'test2' is true not i == 't

Re: [Tutor] Concatenating string

2011-02-22 Thread Adam Bark
it as a string. Thus when you do a=bin(0xff0)+bin(0xff1) you are concatenating the two strings returned by bin. For d you are carrying out the mathematical addition operation on the two numbers before converting it to binary. 2) You've already done that several times, just use bin() HTH, Adam

Re: [Tutor] question regarding regular expression compile

2011-01-12 Thread Adam Bark
ackslashes to give you a backslash character. So your re should now look like this: test = re.compile(r"MAT file (log|billing|util|carrier)\\\d{8} deleted") HTH, Adam. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription opti

[Tutor] paramiko error with put()

2010-12-23 Thread Adam Cryer
Hi I am using paramiko 1.7.6 "fanny" on microsoft windows xp v2002 service pack3 with python 2.4.2 I have the follwing script: *import paramiko hostname='blah' port=22 username='blah' password='blah' fullpath='root\\path\\file.xls' remotepath='/inbox/file.xls' self.client= paramiko.SSHClient

Re: [Tutor] 'or' in assignment (not if statement)?

2010-12-09 Thread Adam Bark
r 1 In [6]: val Out[6]: 1 You are right by the way and I know you can't test every possibility but, as you already suspected the outcome, this just reinforces it I think. HTH, Adam. ___ Tutor maillist - Tutor@python.org To unsubscribe or chan

Re: [Tutor] calling a method within a function

2010-12-07 Thread Adam Bark
On 07/12/10 22:36, John wrote: Hello, I have a strange problem with a piece of code I've written. It's a bit overly complicated to make an example with, but the gist is below. But in the example below, it works. However, in my example, when I call the method from within the function, it returns

Re: [Tutor] role playing game - help needed

2010-12-07 Thread Adam Bark
re is a built in function for summing all the values in a sequence, it's called "sum". HTH Adam. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Pyserial and invalid handle

2010-11-30 Thread Adam Bark
On 01/12/10 01:00, John Smith wrote: Hi, Walter - I got pywin32-214.win32-py2.7.exe because I have the Intel i7 (I'm guessing that the AMD versions are for the AMD processor). However, all of the exe offerings have the same "Python not found in registry" problem that started this whole thing

Re: [Tutor] Random Number Question

2010-11-24 Thread Adam Bark
On 24/11/10 22:10, Jeff Goodwin wrote: Ok, I found the problem, I had saved the file as random.py looks like that was a no-no. Its working now that I changed the name. Thanks! Jeff Ah yes always avoid giving your modules names that appear in the standard library. It goes wrong, sometimes in un

Re: [Tutor] Random Number Question

2010-11-24 Thread Adam Bark
On 24/11/10 21:51, Jeff Goodwin wrote: Hello, I'm trying to find a way to use the random.randint function to generate a random number, but everytime I run the program it locks up IDLE. Here is what I have so far: import random def main(): x = input("Enter a number: ") y = input("Ente

Re: [Tutor] Assistance with Psuedocode

2010-11-17 Thread Adam Bark
On 18/11/10 00:49, Alan Gauld wrote: "Joe Ohmer" wrote The following code works well but I don't understand why the mysteryEffect code block changes the picture. Doesn’t 64*(r/64) just equal r? That dependfs on which version of Python you use. In earlier versions '/' meant integer division

Re: [Tutor] Accessing columns of a CSV file

2010-11-17 Thread Adam Bark
, '26.508'] ['2005/01/31', '23:00:00', '26.508'] ['2005/01/31', '23:12:00', '26.508'] ['2005/01/31', '23:24:00', '26.508'] ['2005/01/31', '23:36:00', '26.508'] ['20

Re: [Tutor] While Loops: Coin Flip Game

2010-11-14 Thread Adam Bark
On 14/11/10 22:16, Dawn Samson wrote: Greetings, I'm a Python beginner and working my way through Michael Dawson's Python Programming for the Absolute Beginner. I'm stuck in a particular challenge that asks me to write a program that "flips a coin 100 times and then tells you the number of he

Re: [Tutor] if statement

2010-11-02 Thread Adam Bark
On 02/11/10 19:36, christopher.h...@allisontransmission.com wrote: Glen Clark wrote on 11/02/2010 03:07:18 PM: in general you should use raw_input instead of input. > confirmed = int(input("Are you happy with this? (y/n): ") > It would appear that Glen is using python 3.x as he used the pri

Re: [Tutor] if statement

2010-11-02 Thread Adam Bark
ht need at least a pass after else as well, although it should be fine to leave it out altogether once you've added the ')'. HTH, Adam. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] if statement

2010-11-02 Thread Adam Bark
On 02/11/10 19:02, Glen Clark wrote: File "/home/glen/workspace/test.py", line 19 if confirmed == "y": ^ SyntaxError: invalid syntax Why does this not work??? PyDev says "Expected:else" It's hard to tell without context. Can you send the code around it as well

Re: [Tutor] Summing up numbers in a file

2010-10-26 Thread Adam Bark
ow to iterate through a file, you could try saving the number of occurrences of each number in the file into a dictionary. Something like: if num in my_dict: my_dict[num] += 1 else: my_dict[num] = 1 HTH. Adam. ___ Tutor maillist - Tutor@python.o

Re: [Tutor] What is random.triangular() used for

2010-10-24 Thread Adam Bark
I think he may be using ipython but putting an "import numpy as np" should get that code to work. HTH Adam. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] searching for newlines does not work!

2010-10-23 Thread Adam Bark
character 'n'. In your first example you put the characters into the string test and replaced the characters. The second example you have actual newlines and are searching for the characters "/n" which don't exist in your string. HTH, Adam. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] What does "TypeError: 'int' object is not iterable"mean?

2010-10-23 Thread Adam Bark
On 23/10/10 13:38, Alan Gauld wrote: "Steven D'Aprano" wrote It would have to be a *very* old version. The use of * as the width parameter in format strings goes back to the Dark Ages of Python 1.5: ... I believe this is a virtual copy of string formatting from C, in which case it probably go

Re: [Tutor] Merging Text Files

2010-10-14 Thread Adam Lucas
nd removes commas. On Thu, Oct 14, 2010 at 13:43, Adam Lucas wrote: > Whoops: > > 1) dictionary.has_key() ??? > 2) I don't know if it's a typo or oversight, but there's a comma in you > dictionary key, line.split(',')[0]. > 3) Forget the database if it's

Re: [Tutor] Converting from unicode to nonstring

2010-10-14 Thread Adam Bark
On 14/10/10 20:33, David Hutto wrote: On Thu, Oct 14, 2010 at 3:31 PM, David Hutto wrote: On Thu, Oct 14, 2010 at 3:24 PM, Adam Bark wrote: On 14/10/10 20:21, David Hutto wrote: On Thu, Oct 14, 2010 at 2:58 PM, Adam Barkwrote: Actually, I needed

Re: [Tutor] Converting from unicode to nonstring

2010-10-14 Thread Adam Bark
On 14/10/10 20:21, David Hutto wrote: On Thu, Oct 14, 2010 at 2:58 PM, Adam Bark wrote: Actually, I needed it to be converted to something without a string attached to it. See a post above, and it was fixed by eval(), Thanks though. And I'm sure at some point this morning in a mome

Re: [Tutor] Converting from unicode to nonstring

2010-10-14 Thread Adam Bark
On 14/10/10 19:29, David Hutto wrote: On Thu, Oct 14, 2010 at 2:19 PM, Sander Sweers wrote: On 14 October 2010 16:14, David Hutto wrote: (u'graph1', u'Line', u'222', u'BLUE', u'1,2,3,4', u'True', u'0,5,0,10') Which is a tuple of unicode strings. From this I need to place portions o

Re: [Tutor] Merging Text Files

2010-10-14 Thread Adam Lucas
Whoops: 1) dictionary.has_key() ??? 2) I don't know if it's a typo or oversight, but there's a comma in you dictionary key, line.split(',')[0]. 3) Forget the database if it's part of a larger workflow unless your job is to adapt a biological workflow database for your lab. On Thu, Oct 14, 2010

Re: [Tutor] Merging Text Files

2010-10-14 Thread Adam Lucas
Either way; nest the for loops and index with protein IDs or dictionary one file and write the other with matches to the dictionary: non-python pseudocode: for every line in TWO: get the first protein ID for every line in ONE: if the second protein ID is the same as the first:

Re: [Tutor] pickle problem

2010-10-12 Thread Adam Bark
oad() File "C:\Python27\lib\pickle.py", line 858, in load dispatch[key](self) KeyError: '<' What does this mean ? It means that it's trying to access a sequence with the key '<' but it's not working. It looks lik

Re: [Tutor] Hiding Superclass Methods

2010-10-11 Thread Adam Bark
On 11/10/10 23:52, Steven D'Aprano wrote: On Tue, 12 Oct 2010 01:55:10 am Adam Bark wrote: On 11/10/10 15:29, Denis Gomes wrote: Thank you both for your responses. I do have one other question if I use the method both of you describe. How do I go about implementing slicin

Re: [Tutor] Hiding Superclass Methods

2010-10-11 Thread Adam Bark
__', '__rmul__', '__setattr__', '__setitem__', '__setslice__', '__sizeof__', '__str__', '__subclasshook__', 'append', 'count', 'extend', 'index', 'insert',

Re: [Tutor] selecting elements from dictionary

2010-09-15 Thread Adam Bark
On 15/09/10 15:31, Hs Hs wrote: Dear Steven, Thanks for your help. however I have a question, using: for key, value in xdic.items(): if 1 in value and 2 in value or 3 in value: print key also print keys that have values such as [1,2,3]. In cases where there is [1,2,3] and [1,2]

Re: [Tutor] How to numerically sort strings that start with numbers?

2010-09-13 Thread Adam Bark
27;21 trewuuioi', '3zxc', '134445'] >>> theList = sorted(theList) >>> theList ['134445', '21 trewuuioi', '3zxc'] >>> theList[::-1] ['3zxc', '21 trewuuioi', '134445'] >>> theList.

Re: [Tutor] How to numerically sort strings that start with numbers?

2010-09-13 Thread Adam Bark
On 14/09/10 01:11, Pete O'Connell wrote: theList = ["21 trewuuioi","3zxc","134445"] print sorted(theList) Hi, the result of the sorted list above doesn't print in the order I want. Is there a straight forward way of getting python to print ['3zxc','21 trewuuioi','134445'] rather than ['134445',

Re: [Tutor] What's the best way to ask forgiveness here?

2010-09-13 Thread Adam Bark
On 13/09/10 20:12, Brian Jones wrote: Thanks for the replies so far. One thing that's probably relevant: once a directory is created, I can expect to write a couple of hundred files to it, so doing a 'try os.makedirs' right off the bat strikes me as coding for the *least* common case instead of

Re: [Tutor] What's the best way to ask forgiveness here?

2010-09-13 Thread Adam Bark
On 13/09/10 19:31, Brian Jones wrote: I've been coding Python long enough that 'asking forgiveness instead of permission' is my first instinct, but the resulting code is sometimes clumsy, and I wonder if someone can suggest something I'm missing, or at least validate what's going on here in som

Re: [Tutor] Serial communication ...

2010-09-13 Thread Adam Bark
On 13/09/10 16:36, Markus Hubig wrote: Hi @all! I'm about to write a class for serial communication on Win32 and Linux which provides a method called "talk" to send something over the serial line, wait for the answer and returns it. My problem is, that I don't know how long the answer will b

  1   2   3   4   >