Re: [Tutor] How convert an int to a string

2013-06-23 Thread Jim Byrnes
On 06/23/2013 06:50 PM, Dave Angel wrote: On 06/23/2013 12:43 PM, Jim Byrnes wrote: On 06/22/2013 06:24 PM, Dave Angel wrote: On 06/22/2013 07:03 PM, Jim Byrnes wrote: On 06/22/2013 05:10 PM, David Rock wrote: * Jim Byrnes [2013-06-22 16:01]: I need to convert a series of digits like 060713

Re: [Tutor] "farkadoodle" or: unique global names, was Re: Data persistence problem

2013-06-23 Thread Jim Mooney
On 22 June 2013 19:24, Steven D'Aprano wrote: > * If you assign to a name (e.g. "spam = 42") anywhere inside the body of a > function, then that name is treated as a local variable, which is a fast > lookup. > > * Otherwise, it is treated as unknown scope, and Python will search nesting > functio

[Tutor] Question about python for web

2013-06-23 Thread Dat Huynh
Dear all, I have a very simple question about running a simple web application with apache on MacOS. Step 1: Copy the file mod_wsgi.so from the link http://code.google.com/p/modwsgi/downloads/detail?name=mod_wsgi-macosx106-ap22py26-3.3.so into the folder "/usr/libexec/apache2" Step 2: Add the f

Re: [Tutor] Python 2 or 3?

2013-06-23 Thread DragonDon
Week, not an experienced user per se, the more important thing is to just start. I can say this, the vast majority of online python classes use v2. So, if you have never programmed before, like myself, then 2 is going to be what you will learn. Learning to upgrade later is no big deal and I doub

Re: [Tutor] Need help appending data to a logfile

2013-06-23 Thread Dave Angel
On 06/17/2013 02:20 PM, Lukáš Němec wrote: Or even better, use python moto, dont re-invent the wheel, so use built in library logging, read the docs for it, or if you want, I can send you some examples how to work it, it takes some time to figure out properly... But what he's doing has

Re: [Tutor] How convert an int to a string

2013-06-23 Thread Dave Angel
On 06/23/2013 12:43 PM, Jim Byrnes wrote: On 06/22/2013 06:24 PM, Dave Angel wrote: On 06/22/2013 07:03 PM, Jim Byrnes wrote: On 06/22/2013 05:10 PM, David Rock wrote: * Jim Byrnes [2013-06-22 16:01]: I need to convert a series of digits like 060713 to a string so I can make it look like a d

Re: [Tutor] Python 2 or 3?

2013-06-23 Thread Mark Lawrence
On 17/06/2013 22:06, Andrew Cooper wrote: Dear Pythoners, Sorry I am completely new to this but so far as I can see there are two versions of Python, version 2 (which is more established and has much more support) and version 3 which is relatively new. As a beginner, which of the versions (2 or 3

Re: [Tutor] Python 2 or 3?

2013-06-23 Thread wolfrage8765
Personally. I say 3, because support for external modules is growing every day and only a few major modules remain, like twisted. But 3 will soon be the standard so start to learn on it now and you will not need to transition latter when 3 replaces 2 as the standard. I currently use 3 and only

Re: [Tutor] Help with Python in ArcGIS 10.1!

2013-06-23 Thread bob gailer
On 6/17/2013 10:26 AM, Jacobs, Teri (CDC/NIOSH/DSHEFS) (CTR) wrote: Hi, Hi - welcome to the tutor list. Be aware that we are a few volunteers. Your question is one very long line. Please in future ensure it is wrapped so we don't have to scroll. I have wrapped it here. I have a command l

Re: [Tutor] Help

2013-06-23 Thread eryksun
On Thu, Jun 20, 2013 at 6:10 PM, Antonio Zagheni wrote: > > I am a begginer in Python. > I did a function that returns a string and I want to copy this to the > clipboard. > I have tried a lot of suggestions found at Google but nothing works properly. > Is there an easy way to do that? > I am usi

[Tutor] Just flushed the queue hence the old mails.

2013-06-23 Thread Alan Gauld
-- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] looking for volunteers with testing simple python program

2013-06-23 Thread Alexander
On Mon, Jun 17, 2013 at 10:17 AM, Lukas Nemec wrote: > Hello, > > I changed some simple python client/server chatroom recipe > to include RSA keypair based encryption and signature verification > > because I'm sick of someone spying on my conversations on FB and similar. > > Here is the code: >

Re: [Tutor] Unix Environment variables

2013-06-23 Thread Steve Willoughby
Note, however, that changing environment variables only affects the environment of your script and it's child processes. Once your script exits, the original shell you called it from is NOT changed. Sent from my iPad On 2013/6/23, at 14:35, Amit Saha wrote: > Hello, > > On Tue, Jun 18, 2013

[Tutor] Help

2013-06-23 Thread Antonio Zagheni
Hi there, I am a begginer in Python. I did a function that returns a string and I want to copy this to the clipboard. I have tried a lot of suggestions found at Google but nothing works properly. Is there an easy way to do that? I am using Python 2.7 and Windows 7. Thanks a lot. Antonio Zagh

Re: [Tutor] EXE Problem

2013-06-23 Thread Lukas Nemec
Do Win+R type: cmd hit enter. in the opened cmd write cd C:/where/you/have/the/exe (you can move it to C: for simplicity) and run it from there it will not close this time, and you can see the debugging info. Enjoy. On 06/19/2013 08:50 AM, Jack Little wrote: I compiled a program in python

Re: [Tutor] python error

2013-06-23 Thread Alexander
On Wed, Jun 19, 2013 at 11:58 AM, Jack Mcgarry < iliketurtles...@googlemail.com> wrote: > Hello ,I am contacting you because I have this bug with my python that > needs solving. You see i coded this program when i was learning to do > graphical coding (still am) and i was using pygame, you may be

Re: [Tutor] Need help appending data to a logfile

2013-06-23 Thread Lukáš Němec
Dne 17. 6. 2013 20:17, Dave Angel napsal(a): On 06/17/2013 01:36 PM, Matt D wrote: Hey, I wrote some simple code to write data to a logfile and it works pretty well (thanks guys). Now my problem is that every time i run the program the old logfile.txt is overwritten. I need to be able to stop

Re: [Tutor] Unix Environment variables

2013-06-23 Thread Amit Saha
Hello, On Tue, Jun 18, 2013 at 9:58 AM, Anu Bhagat wrote: > Hi I am fairly new to python. I will greatly appreciate if some one can tell > me how set up environment variables from a python script. > > Thanks in advance. You can use the 'os' module. This is the document for Python 2 [1]. That sho

[Tutor] Help with Python in ArcGIS 10.1!

2013-06-23 Thread Jacobs, Teri (CDC/NIOSH/DSHEFS) (CTR)
Hi, I have a command line to spread geoprocessing operations across multiple processes to speed up performance. However, I do not know how to import the command line (or at least import it properly) in Python 2.7.2. Here's the script example given on ArcGIS 10.1 Help: import arcpy # Use ha

[Tutor] looking for volunteers with testing simple python program

2013-06-23 Thread Lukas Nemec
Hello, I changed some simple python client/server chatroom recipe to include RSA keypair based encryption and signature verification because I'm sick of someone spying on my conversations on FB and similar. Here is the code: https://github.com/lunemec/python-chat If anyone is interrested

Re: [Tutor] 2 basic problems

2013-06-23 Thread John Harris
Hi Charles, I have added some comments below explaining why you are not getting the results you expect: >>> 4+4 8 The above is an expression, when you hit enter python will evaluate it and give the answer. >>> 3+3=4 SyntaxError: can't assign to operator >>> 3=1 SyntaxError: can't assign to lite

Re: [Tutor] Data persistence problem

2013-06-23 Thread Fábio Santos
On 21 Jun 2013 07:36, "Arijit Ukil" wrote: > > I have following random number generation function > > def rand_int (): > rand_num = int(math.ceil (random.random()*1000)) > return rand_num > > I like to make the value of rand_num (return of rand_int) static/ unchanged after first call even

[Tutor] python error

2013-06-23 Thread Jack Mcgarry
Hello ,I am contacting you because I have this bug with my python that needs solving. You see i coded this program when i was learning to do graphical coding (still am) and i was using pygame, you may be familiar with this program it is called skier. i clicked "run module" and ran skier but when i

Re: [Tutor] How to find descendants recursively?

2013-06-23 Thread Fábio Santos
On Sun, Jun 16, 2013 at 6:20 PM, Timo wrote: > I have a datafile which is parsed by an external library, I'm having trouble > creating a hierarchical structure of the data. > > This is what I got so far: > > items = get_items() # returns a generator > for item in items: > print(item) > chi

[Tutor] Python 2 or 3?

2013-06-23 Thread Andrew Cooper
Dear Pythoners, Sorry I am completely new to this but so far as I can see there are two versions of Python, version 2 (which is more established and has much more support) and version 3 which is relatively new. As a beginner, which of the versions (2 or 3) would it be advisable to start with fir

[Tutor] Unix Environment variables

2013-06-23 Thread Anu Bhagat
Hi I am fairly new to python. I will greatly appreciate if some one can tell me how set up environment variables from a python script. Thanks in advance. Anu -- Nothing is impossible, the word itself says 'I'm possible'. Audrey Hepburn Anu Bhagat SETI Institute 189 North Bernardo Street Mounta

Re: [Tutor] How convert an int to a string

2013-06-23 Thread Jim Byrnes
On 06/22/2013 06:24 PM, Dave Angel wrote: On 06/22/2013 07:03 PM, Jim Byrnes wrote: On 06/22/2013 05:10 PM, David Rock wrote: * Jim Byrnes [2013-06-22 16:01]: I need to convert a series of digits like 060713 to a string so I can make it look like a date 06-07-13. >>> a = 060713 >>> a[:2]

Re: [Tutor] appending/updating values dict key value pairs

2013-06-23 Thread Sivaram Neelakantan
On Sun, Jun 23 2013,eryksun wrote: [snipped 14 lines] > The correct syntax is a dict of dicts: > > {'a': {'foo': 1, 'bar': 2, 'offset': 'fff'}} > > A dict is something of a resource hog, and it's unordered. Use it as > the container because it's mutable and lookups are fast, but for the > v

Re: [Tutor] appending/updating values dict key value pairs

2013-06-23 Thread Sivaram Neelakantan
On Sun, Jun 23 2013,Steven D'Aprano wrote: > On 23/06/13 19:42, Sivaram Neelakantan wrote: [snipped 28 lines] > Python doesn't have structs in the sense you mean. (But see below > for alternatives.) There is a struct module for working with > low-level C-style bytes, ints, doubles etc. but that'

Re: [Tutor] random.choice() problem

2013-06-23 Thread Peter Otten
Dave Angel wrote: > On 06/23/2013 02:18 AM, Jack Little wrote: >> I am trying to use random.choice for a text based game. I am using >> windows 7, 64-bit python. Here is my code: >> >> def lvl2(): >> print "COMMANDER: Who should you train with?" >> trn=random.choice(1,2) >> if trn==

Re: [Tutor] random.choice() problem

2013-06-23 Thread Dave Angel
On 06/23/2013 02:18 AM, Jack Little wrote: I am trying to use random.choice for a text based game. I am using windows 7, 64-bit python. Here is my code: def lvl2(): print "COMMANDER: Who should you train with?" trn=random.choice(1,2) if trn==1: lvl2_1() print "S

Re: [Tutor] appending/updating values dict key value pairs

2013-06-23 Thread eryksun
On Sun, Jun 23, 2013 at 5:42 AM, Sivaram Neelakantan wrote: > I've sort of used a dict of this sort {'a': [1,2,'fff'] } in my > programs and I've noticed that I've got to unpack the list with > hardcoded list positions when I retrieve the value of a key. > > I think I'd be better off, if I did som

Re: [Tutor] appending/updating values dict key value pairs

2013-06-23 Thread Steven D'Aprano
On 23/06/13 19:42, Sivaram Neelakantan wrote: On Sun, Jun 23 2013,Alan Gauld wrote: [snipped 21 lines] But we normally call methods via the object instance rather than the class so simplifying this further we get: b['a'].append('c') Thanks for the detailed explanation. I've sort of used

Re: [Tutor] appending/updating values dict key value pairs

2013-06-23 Thread Sivaram Neelakantan
On Sun, Jun 23 2013,Alan Gauld wrote: [snipped 21 lines] > But we normally call methods via the object instance rather than the > class so simplifying this further we get: > > b['a'].append('c') > Thanks for the detailed explanation. I've sort of used a dict of this sort {'a': [1,2,'fff'] } in