Re: [Tutor] Need some help on output

2011-03-04 Thread David Hutto
That depends on what your motivation is for learning python. I'd start with a few hello world tutorial online. like print "hello world"/ python 3.0 print("hello world"), and on that not, decide on the version you want to use on your system first. ___ Tuto

Re: [Tutor] Error while using calendar module in Python 2.7

2011-03-04 Thread David Hutto
Could you paste the whle code, because I get: >>> import datetime >>> import calendar >>> >>> >>> >>> while monday.weekday() != calendar.MONDAY: ... File "", line 2 ^ IndentationError: expected an indented block >>> monday -= oneday File "", line 1 monday -= oneday ^ Indentati

Re: [Tutor] Error while using calendar module in Python 2.7

2011-03-04 Thread David Hutto
>>> >>> while monday.weekday() != calendar.MONDAY: ... monday -= oneday ... oneweek = datetime.timedelta(days=7) ... nextweek = today + oneweek ... print "next week" ... Traceback (most recent call last): File "", line 1, in NameError: name 'monday' is not defined >>> This means

Re: [Tutor] help

2011-03-08 Thread David Hutto
The first hundred pages of a thorough python tutorial, and a c++ tutorial should have you doing both of those quite well in a day or so. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/

Re: [Tutor] PyQuery

2011-03-10 Thread David Hutto
pseudo: for line in file: query = {} columnheader = line[0] headercontent = line[1] query[columnheader] = [header1content] ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailm

Re: [Tutor] Help with python-gnupg

2011-03-11 Thread David Hutto
Show the entire code, and error for both usages. The usages and a single error message for them both may be enough for someone not to try them out, and who can help you, if they knew more about the problem. Not everyone here will be an expert, but we do read direct code vs direct error, if we've b

Re: [Tutor] Help with python-gnupg

2011-03-11 Thread David Hutto
On Sat, Mar 12, 2011 at 1:39 AM, Becky Mcquilling wrote: > If anyone is familiar with python-gnupg, I am having some difficulty with > the syntax.  I've tried the following: > f = open('c:/test/filename.txt', 'r') > datae = gpg.encrypt_file(f.read(), 'ladym...@gmail.com', > output=open('c:/gpg_tes

Re: [Tutor] Help with python-gnupg

2011-03-11 Thread David Hutto
As a matter of fact, looking at them with know knowledge of the module, it says it's a typeerror, and that it expects string or buffer, but gets file. If this is the same error in both instances, then it's that output needs to be a string or buffer, so just string either the datae variable, or the

Re: [Tutor] Help with python-gnupg

2011-03-11 Thread David Hutto
On Sat, Mar 12, 2011 at 2:07 AM, David Hutto wrote: > As a matter of fact, looking at them with know *no* knowledge of the > module, it says it's a typeerror, and that it expects string or > buffer, but gets file. If this is the same error in both instances, > then it's t

Re: [Tutor] On off Toggle

2011-03-12 Thread David Hutto
You want toggle_power to turn on or off. class Television(object): def __init__(self): pass def toggle_power(self, choice): if choice == 0: poweroff() if choice == 1: poweron() # you set a choice that won't work unless user says choice =

Re: [Tutor] Python closes out on attempt to run script

2011-03-26 Thread David Abbott
7; is assigned to before global declaration global tempf ./temp_test.py:36: SyntaxWarning: name 'tempf' is assigned to before global declaration global tempf Temperature converter, by * *. ' Please enter the Temperature you wish to convert, followed

[Tutor] Converting a numpy matrix to a numpy array

2011-03-30 Thread David Crisp
ing a brain fade. Regards, David ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Converting a numpy matrix to a numpy array

2011-04-03 Thread David Crisp
On Fri, Apr 1, 2011 at 2:04 AM, Peter Otten <__pete...@web.de> wrote: > David Crisp wrote: > >> Hello, >> >> I have a very simple question / problem I need answered.  The problem >> is imnot entirely sure of the correct terminology and langauge to use >&g

[Tutor] Memory profileing on Python 2.7 64bit for windows

2011-04-17 Thread David Crisp
, David ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Overriding a method in a class

2011-05-13 Thread David Knupp
I think the problem is this bit about overriding an object's internal method with one that is defined externally. My gut feeilng is that you'd now have to explicitly pass the object (i.e., self) as well as the string, i.e.: B.addstuff(B, "WXYZ") ...which seems clunky. I'm not familiar with t

[Tutor] PI

2011-05-25 Thread David Merrick
How do I can access to the math module to use PI? area = math.pi * pow(3,2) Traceback (most recent call last): File "", line 1, in area = math.i * pow(3,2) NameError: name 'math' is not defined -- Dave Merrick merrick...@gmail.com Ph 03 3423 121 Cell 027 3089 169 _

Re: [Tutor] Tutor Digest, Vol 87, Issue 114

2011-05-28 Thread David Merrick
As a new user of Pytrhon and previous user of Java,C(+),Php. There is very little difference. In some cases Python might be slower but I don't think it would mnake that much difference. The major differnce is the syntax of how you write and layout your code. Chreers Dave On Sat, May 28, 2011 at 1

Re: [Tutor] Introduction

2011-06-02 Thread David Abbott
had read it before I started posting to mail lists. Have Fun :) David [1] http://curl.haxx.se/mail/etiquette.html ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

[Tutor] Problem

2011-06-17 Thread David Merrick
elf.talk() # feed your critter elif choice == "2": crit.eat() # play with your critter elif choice == "3": crit.play() # some unknown choice else: print("\nSorry, but", choice, "

[Tutor] Using class methods

2011-06-21 Thread David Merrick
I need help using Class methods in another class. I have a class called Critter and I want to create two critters in a farm Class Farm and use Class Critter's methods # A virtual pet to care for class Critter(object): """A virtual pet""" def __init__(self, name, hunger = 0, boredom = 0):

[Tutor] Using Class methods

2011-06-21 Thread David Merrick
I need help using Class methods in another class. I have a class called Critter and I want to create two critters in a farm Class Farm and use Class Critter's methods -- Dave Merrick merrick...@gmail.com Ph 03 3423 121 Cell 027 3089 169 critter_farm2.py Description: Binary data ___

Re: [Tutor] Tutor Digest, Vol 88, Issue 86

2011-06-21 Thread David Merrick
I have created a Critter object and a Farm object which is two critters. I want to use Critters methods in the Farm object as it just 2 critters in a list crit1 = Critter("Sweetie") crit2 = Critter("Dave") farmlet = [crit1,crit2] # Critter Caretaker > # A virtual pet to care for > class Critter(

[Tutor] Class methods

2011-06-21 Thread David Merrick
elif choice == "1": f.talk(farmlet) # feed your critter elif choice == "2": f.eat(farmlet) # play with your critter elif choice == "3": f.play(farmlet) # some unknown choice else:

Re: [Tutor] Tutor Digest, Vol 88, Issue 89

2011-06-22 Thread David Merrick
011 08:58:03 +0100 > From: "Alan Gauld" > To: tutor@python.org > Subject: Re: [Tutor] Class methods > Message-ID: > Content-Type: text/plain; format=flowed; charset="UTF-8"; >reply-type=original > > "David Merrick" wrote > >

Re: [Tutor] Tutor Digest, Vol 88, Issue 89

2011-06-22 Thread David Merrick
; > > ># listen to your critter > > elif choice == "1": > >f.talk(farmlet) > > > ># feed your critter > >elif choice == "2": > >f.eat(farmlet) > > Note that f.ea

[Tutor] Class methods

2011-06-22 Thread David Merrick
Can someone show me how to code this correctly please? # Critter Caretaker # A virtual pet to care for class Critter(object): """A virtual pet""" def __init__(self, name, hunger = 0, boredom = 0): self.name = name self.hunger = hunger self.boredom = boredom #

[Tutor] Class methods

2011-06-26 Thread David Merrick
Is it possible too have crit1 = Critter("Dave") crit2 = Critter("Sweetie") farm = [crit1,crit2] #List# and then be able to use Critters methods on farm? # Critter Caretaker # A virtual pet to care for class Critter(object): """A virtual pet""" def __init__(self, name, hunger = 0, bore

Re: [Tutor] Tutor Digest, Vol 88, Issue 103

2011-06-27 Thread David Merrick
Thanks that should help ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

[Tutor] Python GUI

2011-06-28 Thread David Merrick
# Guess My Number GUI # Create a story based on user input from tkinter import * import random class Application(Frame): """ GUI application that creates a story based on user input. """ def __init__(self, master): """ Initialize Frame. """ super(Application, self).__init__

[Tutor] (no subject)

2011-07-01 Thread David Merrick
# Blackjack # From 1 to 7 players compete against a dealer import cards, games class BJ_Card(cards.Card): """ A Blackjack Card. """ ACE_VALUE = 1 @property def value(self): if self.is_face_up: v = BJ_Card.RANKS.index(self.rank) + 1 if v > 10:

[Tutor] Blackjack Betting

2011-07-02 Thread David Merrick
Each player needs to be able to bet # Blackjack # From 1 to 7 players compete against a dealer import cards, games class BJ_Card(cards.Card): """ A Blackjack Card. """ ACE_VALUE = 1 @property def value(self): if self.is_face_up: v = BJ_Card.RANKS.index(self.r

[Tutor] Blackjackbetting

2011-07-03 Thread David Merrick
HI. I feel I'm starting to go round in circles solving this problem. I feel I made significant progress. Can someone help me iron out the bugs please # Blackjack # From 1 to 7 players compete against a dealer import cards, games class BJ_Card(cards.Card): """ A Blackjack Card. """ ACE_VA

[Tutor] Installing module and running

2011-07-19 Thread David Merrick
I want to install the first module http://code.google.com/p/python-nose/downloads/list -- Dave Merrick merrick...@gmail.com Ph 03 3423 121 Cell 027 3089 169 ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http

[Tutor] Stack problem usind Python2.6

2011-07-21 Thread David Merrick
##from stack import Stack class Stack: def __init__(self): self.items =[] def isEmpty(self): return self.items ==[] def push(self,item): self.items.append(item) def pop(self,item): self.items.pop() def peek(self): return self.items[l

Re: [Tutor] Viability of Python

2011-07-21 Thread David Schouten
__ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > http://mail.python.org/mailman/listinfo/tutor How would one acces the code base? Some time ago, someone responded to a question on this

[Tutor] List problem

2011-07-24 Thread David Merrick
class Node: def __init__(self,initdata): self.data = initdata self.next = None def getData(self): return self.data def getNext(self): return self.next def setdata(self,newData): self.data = newData def setNext(self,newnext): sel

[Tutor] Best way to store and access a fixed coordinate list

2011-08-18 Thread David Crisp
first and second number in the coordinate pair and actually use them in a calculation. suggestions are welcome. I have been focused on this for a few hours now and I think i cant see the trees for the forest (of the problem) Regards, David ___ Tuto

Re: [Tutor] Best way to store and access a fixed coordinate list

2011-08-19 Thread David Crisp
deep in the forest and couldnt see the tree! x = {(1,2),(4,4),(4,6),(3,5)} for eachitem in x: print eachitem,eachitem[0], eachitem[1] Regards, On Fri, Aug 19, 2011 at 1:14 PM, David Crisp wrote: > Hello, > > I have a large grid of numbers  100 * 100 > > I then rando

Re: [Tutor] largest palindrome number

2011-08-27 Thread David Rock
e block, the value in your largest current value will actually be the largest palindrome. -- David Rock da...@graniteweb.com pgpqe98kqh5z1.pgp Description: PGP signature ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Running a script!

2011-12-11 Thread David Smith
If I have understood you correctly you are looking at the Python Shell. On this window choose File then New Window this will open a script window albeit without any code. This window will have a Run menu and within this menu there is a Run Module item which is what I think you are looking for.

[Tutor] Visual and audible system bell

2011-12-11 Thread David Smith
Dear list In a terminal window python3.2 at the command gives me Python 3.2 (r32:88452, Feb 20 2011, 11:12:31) [GCC 4.2.1 (Apple Inc. build 5664)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> then print ("\a") triggers a visual and aud

Re: [Tutor] question about the an exercise in (including the discription about the exercise)

2012-01-04 Thread David Palao
Hi, some hints: 1) strings are iterables 2) help(zip) 3) help(enumerate) Best regards. 2012/1/4 daedae11 > ** > Who can give me an example program about the exercise 6 in chapter 9 in > ? > > The exercise is: > Write a program that compare the two files given by users. If the two > files' cont

Re: [Tutor] PYTHONPATH (Mac OS X)

2012-01-13 Thread David Rock
e that gets generated automatically and is the code that is actually executed. Somehow, calling the method test inside the interpreter is different from running it on the commandline and you are picking up the pyc file. In either case, this format is iffy at best: if __name__ ==

Re: [Tutor] ASCII Conversion

2012-01-30 Thread David Kidd
On Tue, Jan 31, 2012 at 15:50, Michael Lewis wrote: > ... However, if I pass in a string, it's converted to ASCII and will > still satisfy the if statement and print out value. How do I ensure that a > string is caught as a ValueError instead of being converted? It depends on what you want to do

[Tutor] How to make def where arguments are either stated when called or entered via raw_input

2012-02-09 Thread David Craig
Hi, I'm trying to write a function that will either take arguments when the function is called, such as myFunc(x,y,z) or if the user does not enter any arguments, myFunc() the raw_input function will ask for them. But I dont know how to check how many arguments have been entered. My code is be

Re: [Tutor] how to stop a running program in python without closing python interface?

2012-02-12 Thread David Smith
On 12 Feb 2012, at 11:54, Debashish Saha wrote: > actually a i ran a progam in python which is sufficiently large . so i > want to stop the execution of the program now . how can i do this? This will depend on your operating system. On a Mac you press alt + command + esc and the choose the prog

[Tutor] ipython trouble with editor

2012-02-13 Thread David Craig
Hi, I use emacs with ipython (or I would like to) on a GNU/linux machine. To be able to use it from the ipython shell through %ed I added the following lines to my .bashrc file, export LESS="-R" export EDITOR=emacs this seemed to work as when I try %ed filename it opens and is editable in th

[Tutor] return integer from function

2012-02-22 Thread David Craig
Hi, I have a function that calculates the distance between two points on a sphere. It works but I cant get it to return a float for use in another script. Anyone know how I do that?? The function is below, Thanks, D import math def distance_on_unit_sphere(lat1, long1, lat2, long2): # Con

[Tutor] Create a table by writing to a text file.

2012-02-22 Thread David Craig
Hi, I have created a list of containing strings that represent distances between many different points and would like to display the results in a table. I have been trying to write them to a text file but it is difficult to organise them into rows and columns with appropriate spacing to make it

Re: [Tutor] Create a table by writing to a text file.

2012-02-22 Thread David Craig
Thanks everyone, was able to get what I wanted from '/t' but I'm sure the other formatting options will be useful in future. @Peter a = [[]] * 3 >>> a [[], [], []] >>> a[0].append(42) >>> a [[42], [42], [42]] you had me worried for a minute, but a = [[]] * 3 a[0]=[1,2,3] a [[1, 2, 3], [

Re: [Tutor] Which computer operating system is best for Python developers?

2012-02-22 Thread David Rock
stems, will be using methods that might be OS-specific (os.fork() comes to mind). As long as you keep things neutral, you shouldn't have huge issues. -- David Rock da...@graniteweb.com pgpOARLwWTZLn.pgp Description: PGP signature ___ Tutor mail

[Tutor] Solve wave equation

2012-02-23 Thread David Craig
Hi, I am trying to write some code that will solve the 2D wave equation by the finite difference method, but it just returns an array full of zeros and NaN's. Not sure where I am going wrong, the code is attached so if could someone point me in the right direction I'd appreciate this. Thanks D

Re: [Tutor] Solve wave equation

2012-02-23 Thread David Craig
Hooray it works, thanks On 02/23/2012 01:39 PM, Ken Oliver wrote: Do you really want dt = 1**-4 or would 10**-4 be better -Original Message- From: David Craig Sent: Feb 23, 2012 7:57 AM To: tutor@python.org Subject: [Tutor] Solve wave equation Hi, I am trying to write some code that

Re: [Tutor] Solve wave equation

2012-02-23 Thread David Craig
. Anyone know the best way to go about this? thanks, D Original Message Subject:Re: [Tutor] Solve wave equation Date: Thu, 23 Feb 2012 15:24:45 + From: David Craig To: tutor@python.org Hooray it works, thanks On 02/23/2012 01:39 PM, Ken Oliver wrote: Do you

[Tutor] problem editing modules and defs

2012-02-24 Thread David Craig
Hi, I am new to python and have made a couple of definitions. I imported them and they worked ok. I they worked except for one which gave me the error "NameError: global name 'np' is not defined". I then edited my script for the def to include "import numpy as np" saved it and imported the def

[Tutor] problem editing modules and defs

2012-02-24 Thread David Craig
Hi, I am new to python and have made a couple of definitions. I imported them and they worked ok except for one which gave me the error "NameError: global name 'np' is not defined". I then edited my script for the def to include "import numpy as np" saved it and imported the def again. However

Re: [Tutor] problem editing modules and defs

2012-02-24 Thread David Craig
ime) In [615]: a Out[615]: 20.009998091697867 Note: the function originally only returned array[idx], so it seems to have reverted to this somehow. On 02/24/2012 04:28 PM, Evert Rol wrote: Hi David, Hi, I am new to python and have made a couple of definitions. I imported them

Re: [Tutor] creating dict of dict : similar to perl hash of hash

2012-03-06 Thread David Rock
ing data because it doesn't have to be the same data type. You can nest variables, lists, dicts, etc all at the same level: dict = {} dict['mylist'] = [1,2,3] dict['mystring'] = 'string' dict['mynum'] = 4 dict['anotherdict'] = {} dict['anotherdict']['anotherstring'] = 'string2' -- David Rock da...@graniteweb.com pgp8ik0yrru5G.pgp Description: PGP signature ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] creating dict of dict : similar to perl hash of hash

2012-03-06 Thread David Rock
* Thomas Maier [2012-03-07 00:38]: > Hi David, > Mixed data types in nested data structure are possible in Perl as well: > %hash = (); > $hash{'mylist'} = [1,2,3]; > $hash{'mystring'} = 'string'; > $hash{'mynum'} = 4; > $hash{'anot

[Tutor] wave equation boundary conditions

2012-03-18 Thread David Craig
Hi, I have written some code which solve's the 2d wave equation (code is below). It seems to work, however when the wave reaches the boundaries it reflects off them and I would like to remove this effect. Does anyone know of a method to do this? Also, I would like to run it over a large area, but w

Re: [Tutor] using subprocess to export files in bash

2012-05-08 Thread David Abbott
On Tue, May 8, 2012 at 1:41 PM, Alan Gauld wrote: > On 08/05/12 15:18, Rogelio wrote: >> >> While reading the subprocess documentation, I found a great example on >> how to call commands with a PIPE >> >> http://docs.python.org/library/subprocess.html >> >> ** >> output=`dm

Re: [Tutor] Teaching an 8-year-old programming.

2012-05-20 Thread David Abbott
nner-Edition/dp/1435455002 All the best, David ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Python XML for newbie

2012-07-01 Thread David Kidd
On Mon, Jul 2, 2012 at 12:31 PM, Sean Carolan wrote: > How do you say, "If the field is 11, then print the next value"? The > raw XML looks like this: > > > 1 > 11 > 9780470286975 > > Instead of iterating over the whole tree, grab all the elements then retrieve the child, check the field va

Re: [Tutor] Simple text file processing using fileinput module. "Grabbing successive lines" failure

2012-07-02 Thread David Rock
hich case, you can try to resolve the two lines, or fail out if the criteria isn't met. Essentially, your problem isn't with using fileinput, it's with how you handle each line that comes in. -- David Rock da...@graniteweb.com pgpsm5eZpm6mp.pgp Description: PGP signature _

Re: [Tutor] Seeking help with reading and writing files in Python

2012-07-08 Thread David Rock
part, you have already answered your own question. Specifically, you get your input file, FinalProjectBill.txt, by collecting data from the user, doing some calculations, and outputting to the file. I'm not sure I see the problem. :-( -- David Rock da...@graniteweb.com pgp

Re: [Tutor] Python and boot sequences

2012-07-08 Thread David Rock
ironment to use. I think we would need to better understand exactly what you are trying to build, but you are probably looking for something that would be a much lower level than python. -- David Rock da...@graniteweb.com pgp7NxdORAGka.pgp Description: PGP signature ___

Re: [Tutor] confusion about imports

2012-07-09 Thread David Rock
be able to differentiate. module1.DbPath() is not the same thing as module2.DbPath() Your functions.DbPath() is the way to go. -- David Rock da...@graniteweb.com pgpstgBsNVZmH.pgp Description: PGP signature ___ Tutor maillist - Tutor@python.org T

Re: [Tutor] starting to learn

2012-07-13 Thread David Rock
; development boat. > > So starting from scratch, how-to? Coming here is a good start. Welcome! Start here for beginning ideas: http://wiki.python.org/moin/BeginnersGuide You will find a number of good jumping-off points under the "Learning Python" section. Come back as you

Re: [Tutor] Confusion regarding the 'from' statement

2012-08-14 Thread David Rock
s they don't exist in the namespace, but test() knows about them. You are reading too much into the comment that the module is "deleted". -- David Rock da...@graniteweb.com ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] subprocess.Popen help

2012-08-22 Thread David Abbott
gt; > Thanks. > > > Ray Hi Ray, http://www.doughellmann.com/PyMOTW/subprocess/ David ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] What are all those letters after terminal commands?

2012-08-23 Thread David Rock
can use on a commandline, options and arguments. Options are the switches that change the program's behavior and arguments are the inputs to the program (filenames, etc). -- David Rock da...@graniteweb.com ___ Tutor maillist - Tutor@python.org

Re: [Tutor] how to split/partition a string on keywords?

2012-08-23 Thread David Rock
something like: text = raw_input("Enter text: ") sep = 'and' parts = text.split(sep) for i in parts[:-1]: print i print sep print [-1] You might also want to consider stripping whitespace in the individual list items, too. -- David Rock da...@graniteweb.com __

Re: [Tutor] how to split/partition a string on keywords?

2012-08-23 Thread David Rock
* David Rock [2012-08-23 15:03]: > * Jared Nielsen [2012-08-23 12:05]: > > Hi all, > > I'm new to programming and Python. > > I want to write a script that takes a string input and breaks the string at > > keywords then outputs the pieces on separate lines. >

Re: [Tutor] how to split/partition a string on keywords?

2012-08-23 Thread David Rock
rn (parts[0],) else: return parts[:-1] + repart(parts[-1]) if __name__ == '__main__': text = "Ham and cheese omelette with hasbrowns and coffee." parts = repart(text) for part in parts: print part.strip() # Clean up whitespace w

Re: [Tutor] Help Passing Variables

2012-10-26 Thread David Hutto
input("Where should number be centered?: ")) #call the function with the params, and look above to the function SwapCaseAndCenter(a_string, upper_or_lower) -- Best Regards, David Hutto CEO: http://www.hitwebdevelopment.com ___ Tutor maillist

Re: [Tutor] Help Passing Variables

2012-10-26 Thread David Hutto
a_string = raw_input("Give me a word, or letter: ") upper_or_lower = raw_input("upper, or lower character(s): ") center_num = int(raw_input("Where should number be centered?: ")) SwapCaseAndCenter(a_string, upper_or_lower) -- Best Regards,

Re: [Tutor] Help Passing Variables

2012-10-26 Thread David Hutto
ng = raw_input("Give me a word, or letter: ") upper_or_lower = raw_input("upper, or lower character(s): ") center_num = int(raw_input("Where should number be centered?: ")) SwapCaseAndCenter(a_string, upper_or_lower, center_num) -- Best Regards,

Re: [Tutor] Help Passing Variables

2012-10-26 Thread David Hutto
ng.center(center_num).lower() a_string = raw_input("Give me a word, or letter: ") upper_or_lower = raw_input("upper, or lower character(s): ") center_num = int(raw_input("Where should number be centered?: ")) SwapCaseAndCenter(a_string, upper_or_lower, cent

Re: [Tutor] Strings.

2012-10-26 Thread David Hutto
; S has nothing inside of it. > >> >> print(s[0:])# it does not give error > #what does it give? >> print (s[13:13]) # this too does not give error > #What is the output >> why? > Did you at any point use s = {}? -- Best Regards, David Hutto CEO: http://w

Re: [Tutor] reading lines from a list of files

2015-05-12 Thread David Rock
ile reader, plus a host of other useful methods for info about the file you are reading. Part of what you really need to define is the context of your question of "better." What is your use case? From where is your list of files coming? Is it truly just "read and forget"? Your

Re: [Tutor] Should error checking be duplicated for both functions if one function calls another one?

2015-06-01 Thread David Palao
Hello, Not sure if I got it, but, in my opinion functions should do only one thing.So if function 2 finds an error, it should raise it. There should be another function (function 1 in your case?) taking care of possible raised errors. Best 2015-06-01 16:27 GMT+02:00 boB Stepp : > Suppose in a gi

[Tutor] How to import a dictionary from another module?

2015-06-15 Thread David Aldrich
Hi I have defined a dictionary in a module: mydir.py: REG_LOOKUP = { 'REG_1' : some_value1, 'REG_2' : some_value2, } How would I import that dictionary from my main() function (which lives in a different module) please?

Re: [Tutor] How to import a dictionary from another module?

2015-06-15 Thread David Aldrich
Hi I have a solution for this now. Best regards David > -Original Message- > From: Tutor [mailto:tutor-bounces+david.aldrich=eu.nec@python.org] > On Behalf Of David Aldrich > Sent: 15 June 2015 12:03 > To: tutor@python.org > Subject: [Tutor] How to import a dicti

[Tutor] How to return a list in an exception object?

2015-06-17 Thread David Aldrich
more result files differ from the reference result files') I would like to pass back to the caller a list of the files that failed. How would I include that list in the exception object? Best regards David ___ Tutor maillist - Tutor@pyt

Re: [Tutor] How to return a list in an exception object?

2015-06-18 Thread David Aldrich
paths for file in differing_files_list print(path + file) How would I do that association? I guess I need a two-dimensional list but I don't know how to build it. Best regards David ___ Tutor maillist - Tutor@python.org To unsubscri

Re: [Tutor] Root and power

2015-07-29 Thread David Palao
2015-07-29 5:29 GMT+02:00 Job Hernandez : > How is it going tutors? > > The following problem seems impossible to me: > > "*Write a program that asks the user to enter an integer and prints two > integers, root and pwr, such that 0 < pwr < 6 and root^pwr (root**pwr) is > equal to the integer entere

[Tutor] Basic question about docstrings

2015-07-29 Thread David Aldrich
mpt? For getting started with documentation, is Sphinx a good way to go, or would you recommend something simpler? Best regards David ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Basic question about docstrings

2015-07-30 Thread David Aldrich
>> If I have a script called main.py and document a function in it: >> >> def get_value(x): >> """ >> Some text ... >> :param x: Some value >> :returns: Something useful >> """ >> >> What is the most basic way of showing those docstrings at the Python >> prompt? > > Tr

Re: [Tutor] Basic question about docstrings

2015-07-30 Thread David Aldrich
If I have a script called main.py and document a function in it: def get_value(x): """ Some text ... :param x: Some value :returns: Something useful """ What is the most basic way of showing those docstrings at the

Re: [Tutor] Pep 8, about indentation

2015-08-10 Thread David Rock
p as well. set softtabstop=4 It's very handy for allowing the delete key to go back TAB number of spaces (ie, deletes those 4 spaces you just inserted). -- David Rock da...@graniteweb.com ___ Tutor maillist - Tutor@python.org To u

Re: [Tutor] Pep 8, about indentation

2015-08-10 Thread David Rock
* Alex Kleider [2015-08-10 11:26]: > On 2015-08-10 08:33, David Rock wrote: > > > You might want to add softtabstop as well. > > set softtabstop=4 > > > > It's very handy for allowing the delete key to go back TAB number of > > spaces (ie, deletes thos

[Tutor] tkinter create a frame and whats the parent

2015-09-22 Thread David Niklas
tk.Frame.__init___ ? Thanks, David ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

[Tutor] How to read all integers from a binary file?

2015-10-09 Thread David Aldrich
e file. How would I modify this code to read all integers from the file please? Best regards David ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] How to read all integers from a binary file?

2015-10-12 Thread David Aldrich
> data = array.array("i", inf.read()) Thanks for all the answers to my question. I used the array method in the end. Best regards David ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://ma

[Tutor] Guidance on using custom exceptions please

2015-10-12 Thread David Aldrich
timeError): pass Best regards David ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Guidance on using custom exceptions please

2015-10-13 Thread David Aldrich
eems a bit tedious, and is even worse if TxControl imports exceptions from yet another module and allows them to pass up the stack. How would you handle this situation stylistically? David ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] how to grep a word and make a dictionary from multiple lines.

2016-01-04 Thread David Rock
ay to break out of your logic when the next mpath is seen. You will also want to think about what to do with all your LUNs. You have four per mpath, not one. Do you want to capture only one, or do you need all of them? -- David Rock da...@graniteweb.com

Re: [Tutor] how to grep a word and make a dictionary from multiple lines.

2016-01-05 Thread David Rock
path" 2. looking up by value would work, but maybe you should do it the other direction. Your SCSI values will be unique, so use that as the key a "simpler" logic is probably: a) read file b) store the LUN value from your mpath line c) iterate over lines and find SCSI key, then

Re: [Tutor] PLEASE I NEED HELP URGENTLY

2016-01-09 Thread David Rock
comeEvent(handled=False, test=, > result=, outcome='error', exc_info=(, TypeError('this constructor takes no > arguments',), ), reason=None, expected=False, shortLabel=None, > longLabel=None) is not JSON serializable This doesn't appear to be all of your code. What&#

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

2016-03-03 Thread David Rock
vironment but the OP > specifically mentioned writing longer programs and editing > files which is not what IPython does best. I suspect that's > why it didn't get a mention earlier. Very likely, but it's definitely worth mentioning as a runtime environmen

<    4   5   6   7   8   9   10   11   12   >