Re: [Tutor] Recent Documents

2010-05-27 Thread Joel Goldstick
op. > > If anyone has any ideas, please let me know. > > > Thanks, > John S. > > I looked at the file. It is an xml file. There are several xml modules included with python that will help you to read this file. Joel Goldstick __

Re: [Tutor] retrieve URLs and text from web pages

2010-06-29 Thread Joel Goldstick
subscription options: > http://mail.python.org/mailman/listinfo/tutor > > google crawling web pages in python I did a quick check and there are some tutorials. I agree with above -- if you are new to programming, the last thing you need to tackle first are regular expressions! -- Joel G

Re: [Tutor] Suggestions for output on multiple platforms

2010-06-29 Thread Joel Goldstick
you update with links to the csv files. If you don't have security concerns (eg an internal webserver) you could just put them in a directory and not create index.html file so that the listing of csv files would show -- Joel Goldstick ___ Tutor

Re: [Tutor] searching for multiple strings in line.starswith()

2010-07-19 Thread Joel Goldstick
org/mailman/listinfo/tutor > ___ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > http://mail.python.org/mailman/listinfo/tutor > I recently used this code: split_line = line.split(' ', 1) which

Re: [Tutor] xml question

2010-07-26 Thread Joel Goldstick
~ > > ___ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > http://mail.python.org/mailman/listinfo/tutor > > I haven&#x

Re: [Tutor] append in new file??

2010-07-27 Thread Joel Goldstick
; note all outputs in txt file. > You need to use append mode when you open the file http://docs.python.org/library/functions.html?highlight=open#open -- Joel Goldstick ___ Tutor maillist - Tutor@python.org To unsubscribe or change su

[Tutor] A unicode print question

2010-07-30 Thread Joel Goldstick
why not: Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56) [GCC 4.4.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> s = u'La Pe\xf1a' >>> print s La Peña >>>

[Tutor] A unicode print question

2010-07-30 Thread Joel Goldstick
or "license" for more information. >>> s = u'La Pe\xf1a' >>> print s La Peña >>> import sys >>> sys.getdefaultencoding() 'ascii' > -- Joel Goldstick ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Formatting date/time

2010-08-04 Thread Joel Goldstick
ading >> zero? Like: 'Wed, 4 Aug 2010 17:58:42 +' >> >> It looks like it's not in the docs. >> >> Thanks >> >> Eduardo >> > %e worked for me on Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56) -- Joel Goldstick ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Making String

2010-08-10 Thread Joel Goldstick
your list is. > > Thank you, > ~Corey Richardson > ___ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > http://mail.python.org/mailman/listinfo/tutor > -- Joel Goldstick ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Making String

2010-08-11 Thread Joel Goldstick
On Tue, Aug 10, 2010 at 6:22 PM, Steven D'Aprano wrote: > On Wed, 11 Aug 2010 06:09:28 am Joel Goldstick wrote: > > The str part of str.join() is the string where the result is stored, > > so you can start off with an empty string: "" > > I don't und

Re: [Tutor] Indentation woes in elif statement

2010-08-11 Thread Joel Goldstick
Most people use 4 spaces. You can use any number of spaces, but you need to be consistant The elif indentation must match its matching if statement. In this case neither are indented The block which executes under the elif is indented to the same level as that under the original if Joel Goldstick

Re: [Tutor] import errors

2010-08-11 Thread Joel Goldstick
n2.4/site-packages/Numeric' > '/usr/lib/python2.4/site-packages/gtk-2.0' > > > HTH, > > Emile > > > ___ > Tutor maillist - Tutor@python.org > To unsubscribe or chang

Re: [Tutor] Learning Python ...Books

2010-08-13 Thread Joel Goldstick
___ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > http://mail.python.org/mailman/listinfo/tutor > > -- Joel Goldstick ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] reading from 2 file output to 1

2010-08-17 Thread Joel Goldstick
en write the value to the output file. -- Joel Goldstick On Tue, Aug 17, 2010 at 6:29 AM, Nitin Das wrote: > I think in both the while loops , for loops are iterating over the new > lines, as a result col1,col2,col3,col4,col5,col6,col7 as a result after both > the while loop finishes the

Re: [Tutor] question about a exercise.

2010-08-19 Thread Joel Goldstick
__ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > http://mail.python.org/mailman/listinfo/tutor > > -- Joel Goldstick ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] flow problem with a exercise

2010-08-19 Thread Joel Goldstick
return uitkomst gives the outcome to even. > But the intepreter thinks otherwise. > > I work on a Win7 machine with Python 2.7 > > Roelof > > > ___ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > http://mail.python.org/mailman/listi

Re: [Tutor] import prroblem

2010-08-28 Thread Joel Goldstick
t; http://mail.python.org/mailman/listinfo/tutor > > it is spelled wrong -- should be calendar -- Joel Goldstick ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] recursive problem

2010-09-09 Thread Joel Goldstick
;s the python way to solve this >> >> >> I am not sure what do you want to achieve by this ? >> What is the problem statement ? >> >> The problem statement is that I must count how many times the target is in >> the nested_list. >> So I thougt that every nested list the function is called again so this >> list is also iterated. >> > > Let's say n, l = 2, [2, 9, [2, 1, 13, 2], 8, [2, 6]] > Simply Flatten the list l, which will be then be; flatten(l) = [ 2, [2, 9, > 2, 1,13, 2, 8, 2, 6 ] > Now count for n; flatten.count(n) > > > > -- > ~l0nwlf > > ___ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > http://mail.python.org/mailman/listinfo/tutor > > -- Joel Goldstick ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] recursive problem

2010-09-09 Thread Joel Goldstick
On Thu, Sep 9, 2010 at 10:26 AM, Luke Paireepinart wrote: > Shouldn't there be a way to do this without type checking? Duck typing! > > Your post got me thinking. Maybe better to test if the object can return an iter method. If it throws an error, then look at its value. If it doesn't, then its

Re: [Tutor] recursive problem

2010-09-09 Thread Joel Goldstick
On Thu, Sep 9, 2010 at 12:07 PM, Steven D'Aprano wrote: > On Fri, 10 Sep 2010 01:05:22 am Joel Goldstick wrote: > > On Thu, Sep 9, 2010 at 10:26 AM, Luke Paireepinart > > > > wrote: > > > Shouldn't there be a way to do this without type checking? Duck &g

Re: [Tutor] Random list exercise

2010-09-09 Thread Joel Goldstick
] line and replace chosenword in the append(... with words[index] 3. your list doesn't contain any duplicate words. Since your program is supposed to catch this, you should add a duplicate to see if it works. (No!) 4. I think your line del words[index] is supposed to help out with

Re: [Tutor] Random list exercise

2010-09-09 Thread Joel Goldstick
On Thu, Sep 9, 2010 at 5:42 PM, Joel Goldstick wrote: > > > On Thu, Sep 9, 2010 at 4:51 PM, lists wrote: > >> Hi tutors, >> >> Still on my Python learning journey! I've just competed an exercise >> which asks the student to "Create a program that cr

Re: [Tutor] changing list index start

2010-09-11 Thread Joel Goldstick
special cases, I doubt it would be worth > the time or trouble to formally make the request. > > Maybe I should ask if there is a better way to do what I want to do > here. Is there? > ___ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > http://mail.python.org/mailman/listinfo/tutor > -- Joel Goldstick ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] changing list index start

2010-09-11 Thread Joel Goldstick
27;m too inexperienced with Python to consider myself good at it, I think the key to using python is to 'get it' as to the fundamental data types in python and how they make things easier to solve problems. One of the earliest programming books I read was 'Algorithms + Data Structures = Programs' by Niklaus Wirth. The book used Pascal, which I think the author wrote. But no matter the language, learn what data structures it offers, and why and then your algorithms will become simpler and more elegant. If you find yourself doing weird things with your code, see if you can rethink how you organize your data -- Joel Goldstick ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] tree problem

2010-09-12 Thread Joel Goldstick
lp(os) while in your python shell to learn what methods are available. Traversing a tree is also sometimes called 'walking' good luck -- Joel Goldstick ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] tree problem

2010-09-12 Thread Joel Goldstick
uld probably write a function to see if you can do > > that. That's pretty easy > > > > 2. You need to traverse a tree. I see you are using os module. You > > should try help(os) while in your python shell to learn what methods > > are available. Traversing a tree is

Re: [Tutor] tree problem

2010-09-12 Thread Joel Goldstick
>> You really have two problems here: > >> > >> 1. You need to know how to write an empty file with the name > >> litter.py. You should probably write a function to see if you can do > >> that. That's pretty easy > >> > >> 2. Y

Re: [Tutor] wierd replace problem

2010-09-13 Thread Joel Goldstick
s: `and the moral of that is--"Oh, > 'tis love, 'tis love, that makes the world go round!"' > > So I think I have to replace the '. > > Roelof > > ___ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > http://mail.python.org/mailman/listinfo/tutor > That is a completely different problem than the one you originally posed. I doubt that what you inserted above is actually completely correct. It opens with a back tick, has a back tick before and, then ens with what looks like a double quote then a single quote -- Joel Goldstick ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] wierd replace problem

2010-09-13 Thread Joel Goldstick
> > -- > Bob Gailer > 919-636-4239 > Chapel Hill NC > > ___ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > http://mail.python.org/mailman/listinfo/tutor > How abou

Re: [Tutor] wierd replace problem

2010-09-13 Thread Joel Goldstick
On Mon, Sep 13, 2010 at 6:41 PM, Steven D'Aprano wrote: > On Tue, 14 Sep 2010 04:18:36 am Joel Goldstick wrote: > > > How about using str.split() to put words in a list, then run strip() > > over each word with the required characters to be removed ('`") > &g

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

2010-09-14 Thread Joel Goldstick
e method I would use is to strip each string of anything beyond its leading digits, save that as a key, use the string as the value. Then sort by key -- Joel Goldstick ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] FW: wierd replace problem

2010-09-14 Thread Joel Goldstick
d_count[stripped_words] += 1 13 except KeyError: 14 word_count[stripped_words] = 1 15 16 ordered_keys = word_count.keys() 17 ordered_keys.sort() 18 ##print ordered_keys 19 print "All the words and their frequency in 'a

Re: [Tutor] FW: wierd replace problem

2010-09-14 Thread Joel Goldstick
this: """'")""" its hard to make out.. so with double spacing (you can't do this.. just to illustrate:): """ ' " ) """ > > > -- Joel Goldstick __

Re: [Tutor] help with integers

2010-09-14 Thread Joel Goldstick
r message > Ciera > post your code.. and also windows/linux/mac? if you post code and error message it will be easier to help > ___ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > http://mail.pyth

Re: [Tutor] working with empty lists

2010-09-16 Thread Joel Goldstick
t I > don't understand how > ___ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > http://mail.python.org/mailman/listinfo/tutor > -- Joel Goldstick ___ Tutor maill

Re: [Tutor] working with empty lists

2010-09-16 Thread Joel Goldstick
On Thu, Sep 16, 2010 at 11:46 AM, Rance Hall wrote: > On Thu, Sep 16, 2010 at 9:24 AM, Joel Goldstick > wrote: > > I typed in this: > > > > > > 3 l = [] > > 4 > > 5 for i in range(0,10): > > 6 l.append(i+1) > > 7 > > 8

Re: [Tutor] Remove a dictionary entry

2010-09-17 Thread Joel Goldstick
ontaining > only one entry. How should I do that? > > You can loop through all the entries in d, and remove the entries that have length one. Hope that isn't too much of a hint > > Question 2 : where should I have found this answer myself? (apart from > here) > > &g

Re: [Tutor] Help - importing modules

2010-09-18 Thread Joel Goldstick
our program or in the sys.path list you don't use the extension. import filename is all you need, not import filename.py -- Joel Goldstick ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Why are arguments sometimes on the left side?

2010-09-20 Thread Joel Goldstick
file.class or class.method > etc. > > > > I googled this, but didn’t find it. > > > > Thank you, > > Mike > > > ___ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > http://mail.python.org/mailman/listinfo/tutor >

Re: [Tutor] Why are arguments sometimes on the left side?

2010-09-20 Thread Joel Goldstick
python.org/library/stdtypes.html#built-in-types > > > ___ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > http://mail.python.org/mailman/listinfo/tutor > -- Joel Goldstick ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Opening C++ binary files

2010-09-21 Thread Joel Goldstick
> > > > -Joe > ___ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > http://mail.python.org/mailman/listinfo/tutor > fileobj = open(filename, mode='wb') will open the file. Do you have any documenta

Re: [Tutor] Opening C++ binary files

2010-09-21 Thread Joel Goldstick
On Tue, Sep 21, 2010 at 1:23 PM, bob gailer wrote: > On 9/21/2010 12:34 PM, Joel Goldstick wrote: > > > > On Tue, Sep 21, 2010 at 12:03 PM, Joe Bennett wrote: > >> I have some binary files created by a program written in C++... Anyone >> have any experience with th

Re: [Tutor] Opening C++ binary files

2010-09-21 Thread Joel Goldstick
On Tue, Sep 21, 2010 at 1:23 PM, bob gailer wrote: > On 9/21/2010 12:34 PM, Joel Goldstick wrote: > > On Tue, Sep 21, 2010 at 12:03 PM, Joe Bennett wrote: >> >> I have some binary files created by a program written in C++... Anyone >> have any experience with this

Re: [Tutor] class method problem

2010-09-27 Thread Joel Goldstick
return index index = index + 1 return -1 -- Joel Goldstick ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] dynamic arrays?

2010-09-27 Thread Joel Goldstick
e to a, your first value is stored, in a[0], etc. Read about slices. They're fun, and informative to understand indexing concepts in python -- Joel Goldstick ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] dynamic arrays?

2010-09-27 Thread Joel Goldstick
On Mon, Sep 27, 2010 at 1:52 PM, Steven D'Aprano wrote: > On Tue, 28 Sep 2010 02:12:55 am Joel Goldstick wrote: > >> a=[] >> i=0 >> for l in open("file.txt", "r"): >>  a[i]=l >>   i+=1 > > Did you try it before posting? > That

Re: [Tutor] filling 2d array with zeros

2010-09-27 Thread Joel Goldstick
r > I don't know how you are figuring out your size, but if you note below, you can create a list with one element value 0, then multiply it by length you need and result is than length of array filled with 0s x = [0] * 4 >>> x [0, 0, 0, 0] -- Joel Goldstick ___

[Tutor] Fwd: Writing a txt from dbf

2010-09-28 Thread Joel Goldstick
our code, but I am not sure what dbf module you are using.  I am running UBUNTU 9.10 and can't find a dbf module in the repository. What are you running? -- Joel Goldstick -- Joel Goldstick ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] inheritance problem

2010-09-30 Thread Joel Goldstick
..@python.org > To unsubscribe or change subscription options: > http://mail.python.org/mailman/listinfo/tutor > -- Joel Goldstick ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] function error

2010-10-02 Thread Joel Goldstick
# I copied your code between the hash lines and get this: File "my_turtle.py", line 19 if (abs(turtle.position()[0]) > turtle.window_height()/2) or ^ SyntaxError: inval

Re: [Tutor] Using contents of a document to change file names

2010-10-02 Thread Joel Goldstick
ng the information for the file changing operation from the >> contents of a document. >> >> As you can imagine, I'm pretty green in Python programming and I was >> hoping >> the learn by doing method would work. I need t

Re: [Tutor] CGI HELP

2010-10-06 Thread Joel Goldstick
supposed to return a list of environmental variables in a given > order. > Sadly only the header displayed. > I have looked through over and over, please what am i doing wrong. > This is from Deitel How to program python, Chapter 6. > > thanks and best regards. > -- > did you lose the indentation in copying code to email? -- Joel Goldstick ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] how to extract data only after a certain condition is met

2010-10-06 Thread Joel Goldstick
uot; in the >> case of a file. >> > > This is what I do unless the files are _really big_ > > For-me-really-big-is-over-200Mb-ish-ly y'rs, > > Emile > > Why not loop with readline() and then the slice. That way only one line at > time in memory > --

Re: [Tutor] Rounding a Python float to the nearest half integer

2010-10-08 Thread Joel Goldstick
9] > >>> r = [round(2*x)/2.0 for x in n] # double, round, then divide by 2.0 > >>> r > [1.0, 1.0, 1.0, 1.5, 1.5, 1.5, 1.5, 1.5, 2.0, 2.0] > >>> > > -- Joel Goldstick ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] WRITING XLS FROM OS.WALK()

2010-10-11 Thread Joel Goldstick
excel, or any other spreadsheet can read the file. Python offers csv support, its easy to understand, produces small files, and being a text format, it is easy to debug problems. -- Joel Goldstick ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] SQLite3 DB Field Alphabetizing

2010-10-12 Thread Joel Goldstick
self.liorder.append(str(graphname[0]).lstrip('u')) > > __ > -- Joel Goldstick ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Using contents of a document to change file names, (was Re: how to extract data only after a certain ...)

2010-10-12 Thread Joel Goldstick
o > be very intuitive. > Here is a discussion of how to iterate over a dictionary in sorted order: http://stackoverflow.com/questions/364519/in-python-how-to-i-iterate-over-a-dictionary-in-sorted-order -- Joel Goldstick ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Using contents of a document to change file names, (was Re: how to extract data only after a certain ...)

2010-10-12 Thread Joel Goldstick
On Tue, Oct 12, 2010 at 2:46 PM, Josep M. Fontana wrote: > > > On Tue, Oct 12, 2010 at 8:37 PM, Joel Goldstick > wrote: > >> >> >> On Tue, Oct 12, 2010 at 1:52 PM, Josep M. Fontana < >> josep.m.font...@gmail.com> wrote: >> >>> Tha

Re: [Tutor] Using contents of a document to change file names, (was Re: how to extract data only after a certain ...)

2010-10-12 Thread Joel Goldstick
On Tue, Oct 12, 2010 at 3:39 PM, Sander Sweers wrote: > On 12 October 2010 21:15, Joel Goldstick wrote: > > When the dictionary is retrieved, its order depends on the hashed values > > rather than the keys themself. > > If (big IF here) you really need an ordered

Re: [Tutor] pickle problem

2010-10-12 Thread Joel Goldstick
oad(F). The thing you are trying to load is a file that was a copy of the contents of the url. It is html, and not 'pickled' I think you are missing a line or two of code from your example tutorial > > Roelof > > ___ > Tutor m

Re: [Tutor] SQLite3 DB Field Alphabetizing

2010-10-13 Thread Joel Goldstick
e front of > these results but in fact those 'u's lie outside the string, they > are a part of Python's representation of a unicode string, > not a part of the string. > > So if you remove the call to strip() your code will return > the result you expected. &

Re: [Tutor] join question

2010-10-14 Thread Joel Goldstick
t; > > ___ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > http://mail.python.org/mailman/listinfo/tutor > -- Joel Goldstick ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Converting from unicode to nonstring

2010-10-14 Thread Joel Goldstick
To take a string of comma separated integers and convert to a list of floats: >>> x = u'1,2,3,4' >>> y = x.split(',') >>> z = [float(f) for f in y] >>> z [1.0, 2.0, 3.0, 4.0] >>> -- Joel Goldstick _

Re: [Tutor] join question

2010-10-14 Thread Joel Goldstick
joining of each element of the list, but also you need to have the correct argument for getinfo. In your first example you append ".txt" to p, but in the loop example you fail to append it. See my earlier post -- Joel Goldstick ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Converting from unicode to nonstring

2010-10-15 Thread Joel Goldstick
the below will work. > > [int(n) for n in u'1,2,3,4'.replace(',', '')] > > Greets > Sander > or this: >>> s = '1, 200 , -3,4' # or whatever >>> [int(x) for x in s.split(',')] [1, 200, -3, 4] or this: To take a

Re: [Tutor] Problems with partial string matching

2010-10-24 Thread Joel Goldstick
replaced by the same > string followed by the string corresponding to the year value in the > dictionary (also a string) > -- > > I run this and I don't get any errors. The names of the files in the > directory, however, are not changed. What am

Re: [Tutor] if statement

2010-11-02 Thread Joel Goldstick
h item would you like to change: ") In the line about you have mismatched parentheses. This confuses the parser ___ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > http://mail.python.org/mailman/listinfo/tutor > -- Joel Goldstick ___ 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 Joel Goldstick
): print(Entries[In] + ": " + str(In)) change = int(input("Which item would you like to change: ") Entries[change]=str(input("Please enter a nem name: ") > else: > #do nothing > Actually, I caught two mismatched parens. In the line startin

Re: [Tutor] How to copy file from a source, I do not know the source file name, Only path to the src directory I know

2010-11-09 Thread Joel Goldstick
rder. It does not include the special entries '.' and '..' even if they are present in the directory. > > ___ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > http://mail.python.org/mailman/listinfo/tutor > -- Joel Goldstick ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] put query result set into dictionary

2010-11-10 Thread Joel Goldstick
> envsql: select envVariable, envValue from ODS_ENV_DICT where envName = > 'ST2' > > envDB systest2 > > Traceback (most recent call last): > > *File "H:\workspace\test\src\root\nested\example.py", line 33, in > * > > envDict[envVariable].a

Re: [Tutor] Finally finished my currency exchange program

2010-12-03 Thread Joel Goldstick
ting the application on the web, install issues disappear, and you might get more hits on your site. -- Joel Goldstick ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] floats

2010-12-03 Thread Joel Goldstick
don't think that is what you want, but since floating point arithmetic is done in binary there are rounding errors. You might want to look at the decimal module > _______ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > http://mail.python.org/mail

Re: [Tutor] modified dictionary class

2010-12-06 Thread Joel Goldstick
etattr__(self, attr, value): >self[attr] = value > >def set_with_dict(self,D): >""" set attributes with a dict """ >for k in D.keys(): >self.__setattr__(k,D[k]) > _____

Re: [Tutor] Save file in a specific directory

2010-12-07 Thread Joel Goldstick
filename > self.name = f > if new: > # new table (table file must be > # created or opened and truncated) > self.stream = file(f, "w+b") > else: > # tabe file must exist > self.stream = file(f, ("r+b", "rb")[bool(readOnly)]) > > >> >> > > > ___ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > http://mail.python.org/mailman/listinfo/tutor > > Do you have write privilege in the directory where you want to create the file? -- Joel Goldstick ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Increment by string, Array

2010-12-09 Thread Joel Goldstick
ariable is it won't process the SQL > statement any longer because of the quotes around it. The format has to stay > in (' "PATH" = X') > for it to ingest correctly, another way would be "\"PATH\" = 1"

Re: [Tutor] the "**" operator?

2010-12-10 Thread Joel Goldstick
illist - Tutor@python.org > To unsubscribe or change subscription options: > http://mail.python.org/mailman/listinfo/tutor > -- Joel Goldstick ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Tab delimited question

2010-12-13 Thread Joel Goldstick
just the word > following the tag w/ the form: line[start: stop], it prints nothing > (it seems b/c my stop variable is incorrect). > > I would greatly appreciate any help you have. This is a much > simplified example from the script I'm actually writing, but I need to > figure out a way to el

Re: [Tutor] Choice of Python

2010-12-28 Thread Joel Goldstick
t; > > Is python really worth the pain or should I just skip it ? > > > > Thank you so much. > > > > > > *Abdulhakim Haliru* > > * * > > > > ___ > Tutor maillist

Re: [Tutor] Concatenating string

2011-02-23 Thread Joel Goldstick
ibe or change subscription options: > http://mail.python.org/mailman/listinfo/tutor > > bin is new in 2.6 .. check your version -- Joel Goldstick ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Convert string to long

2011-02-24 Thread Joel Goldstick
ou want. Then add back the 0x prefix q.e.d. >>> h = hex(546) >>> h '0x222' >>> n = h[2:] >>> n '222' >>> n.zfill(5) '00222' >>> '0x' + n.zfill(5) '0x00222' >>> This can all be simplified (well .. shortened!) to >>> '0x' + hex(543)[2:].zfill(5) '0x0021f' -- Joel Goldstick ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Convert string to long

2011-02-24 Thread Joel Goldstick
em? If you do want leading zeros because it makes your display look more proper, then you do the string formatting to get what you need. Go back and read some tutorials or the python manual to understand data types. -- Joel Goldstick ___ Tutor mailli

Re: [Tutor] Dynamically assign variable names to tuple objects

2011-03-01 Thread Joel Goldstick
ange subscription options: > http://mail.python.org/mailman/listinfo/tutor > Just some quick ideas: Read about Generators. Using Hugo's snippet for reading a file a line at a time, you can write a function to yield a single line of the file for each call. Do this f

Re: [Tutor] How to extract data from text to excel?

2011-03-03 Thread Joel Goldstick
ython """ Read a file containing a long string of ones and zeros Separate each bit with a comma, then write the whole csv thing to an output file. This can be read by an excel like application with one bit in each row of the first column """ f = open('./robert.txt',&

Re: [Tutor] ctypes question

2011-03-07 Thread Joel Goldstick
ions: > http://mail.python.org/mailman/listinfo/tutor > > "but that path doesn't actually exist... replace that path with either r"d:/temp/spssio32.dll" or with "d://temp//spssio32.dll"; otherwise the /t will be transformed into a tab. Nick" I don&#

Re: [Tutor] ctypes question

2011-03-08 Thread Joel Goldstick
ike it could cause other problems with the code. I don't do python on windows, and have unremembered a lot I used to know about windows. So, my question is, isn't there another way to do this? -- Joel Goldstick ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] CSV to Excel

2011-03-11 Thread Joel Goldstick
r.writerow(aRow) > else: > aRow1 = [""+filepath+","+filename+",0"] > writer.writerow(aRow1) > print "El archivo esta listo" > > ___ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > http://mail.python.org/mailman/listinfo/tutor > > -- Joel Goldstick ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] CSV Ouptut concern...

2011-03-17 Thread Joel Goldstick
Mobile Banking Solutions | Transaction Processing | Enterprise Application > Development > > ___ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > http://mail.python.org/mailman/listinfo/tutor > >

Re: [Tutor] books Recommendation

2011-03-18 Thread Joel Goldstick
shing And of course this list! -- Joel Goldstick ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Need some clarification on this

2011-03-19 Thread Joel Goldstick
_ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > http://mail.python.org/mailman/listinfo/tutor > True means not zero, not "". Any numeric value but 0 is true. so you have True and True. I thi

Re: [Tutor] Need some clarification on this

2011-03-19 Thread Joel Goldstick
_ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > http://mail.python.org/mailman/listinfo/tutor > Oops. I misread your post. I (why I don't know) thought I saw a = 5, b = 4. a and b are names.

Re: [Tutor] Saving information for my program

2011-03-21 Thread Joel Goldstick
stuff to > read is great, explaining it here is great, writing short example code is > great too, anything helps. > > What is it about you... that intrigues me so? > > > > ___ > Tutor maillist -

Re: [Tutor] Parsing data from a csv file

2011-03-24 Thread Joel Goldstick
to do that. The for i in range(1::): will give you an error. The range parameter needs to be something with a length, like a string, or a list, or a tuple. Can you show a little bit of your data file, and give us the traceback and output of your program? > _____

Re: [Tutor] Fw: Fw: Fw: Parsing data from a csv file [NC]

2011-03-24 Thread Joel Goldstick
mail.python.org/mailman/listinfo/tutor*<http://mail.python.org/mailman/listinfo/tutor> > > > * > This message and any attachments (the "message") are confidential, intended > solely for the addressee(s)

Re: [Tutor] script conversion windows -> linux error

2011-03-25 Thread Joel Goldstick
have you tried help(config.get) in the python interactive shell? -- Joel Goldstick ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Write new line(enter) in txt

2011-03-28 Thread Joel Goldstick
not binary. Then your \n will be translated into whatever end of line sequence your operating system requires. http://docs.python.org/tutorial/inputoutput.html#reading-and-writing-files > ___ > Tutor maillist - Tutor@python.org > To unsubscribe

Re: [Tutor] Write new line(enter) in txt

2011-03-28 Thread Joel Goldstick
information contained in the message. If you are not the intended >> recipient, you should delete this email and notify the sender immediately. >> >> Any views or opinions expressed in this email are those of the sender >> only, unless otherwise stated. All copyright in any Capita material in this >> email is reserved. >> >> All emails, incoming and outgoing, may be recorded by Capita and monitored >> for legitimate business purposes. >> >> Capita exclude all liability for any loss or damage arising or resulting >> from the receipt, use or transmission of this email to the fullest extent >> permitted by law. >> > > > ___ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > http://mail.python.org/mailman/listinfo/tutor > > -- Joel Goldstick ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Read arguments from command line

2011-03-28 Thread Joel Goldstick
- Tutor@python.org > To unsubscribe or change subscription options: > http://mail.python.org/mailman/listinfo/tutor > > -- Joel Goldstick ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] (sqlite3) Testing if a table has been created.

2011-04-06 Thread Joel Goldstick
e a > different way? > > > > > > > > What is it about you... that intrigues me so? > > > ___ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > http://mail.python.org/m

Re: [Tutor] (sqlite3) Testing if a table has been created.

2011-04-06 Thread Joel Goldstick
een created. > > On Wed, Apr 6, 2011 at 4:06 PM, michael scott wrote: > >> Is this really a python tutor question? Oh, well, try this: >> http://lmgtfy.com/?q=sqlite+test+if+table+exists >> >> -- >> Joel Goldstick >> >> >> My apologies, I

  1   2   3   4   5   6   >