Re: [Tutor] Hello World in Python without space

2011-07-15 Thread Richard D. Moores
On Fri, Jul 15, 2011 at 21:38, Steven D'Aprano wrote: > > Richard D. Moores wrote: > >> But that makes me wonder if there isn't a simpler way to do it with >> Python -- to delete the contents of a file without deleting the file? > > Opening a file for writing will flush the contents. > > open(file

Re: [Tutor] IDLE/tk in 10.6

2011-07-15 Thread Steven D'Aprano
Luke Thomas Mergner wrote: [...] I'd like to try IDLE but there appears to be a known bug with 10.6's version of ActiveTCL. I've installed a newer version 8.5 via their website, but this has not fixed the problem. The module tkinter is still unable to load. Since both python and activeTCL ar

Re: [Tutor] Filling orders FIFO

2011-07-15 Thread Steven D'Aprano
Charles John wrote: Hi I am new to python and was wondering what the best way to create an order(bid and offer) queue, then match a bid and offer so that if bid==offer, creates a filled order FIFO in python cgi using mysql? Does anybody have any ideas? It would be greatly appreciated. The simpl

Re: [Tutor] Hello World in Python without space

2011-07-15 Thread Steven D'Aprano
Richard D. Moores wrote: But that makes me wonder if there isn't a simpler way to do it with Python -- to delete the contents of a file without deleting the file? Opening a file for writing will flush the contents. open(filename, 'w') will do it, taking advantage of Python's garbage collecto

Re: [Tutor] Hello World in Python without space

2011-07-15 Thread Richard D. Moores
On Fri, Jul 15, 2011 at 17:16, Dave Angel wrote: > On 07/15/2011 07:39 PM, Richard D. Moores wrote: >> with open("C:/test/test.txt", "a") as file_object: >>      print("Hello, world!", file=file_object) >> >> Yes, that works for me with Windows Vista. However, if test.txt is >> empty, it puts in

Re: [Tutor] Hello World in Python without space

2011-07-15 Thread Dave Angel
On 07/15/2011 07:39 PM, Richard D. Moores wrote: On Fri, Jul 15, 2011 at 16:21, xDog Walker wrote: I believe on Windows, you can almost always use a forward slash in a path: C:/somewhere/somewhereelse/ with open("C:/test/test.txt", "a") as file_object: print("Hello, world!", file=file_o

Re: [Tutor] Hello World in Python without space

2011-07-15 Thread Richard D. Moores
On Fri, Jul 15, 2011 at 16:21, xDog Walker wrote: > I believe on Windows, you can almost always use a forward slash in a path: > C:/somewhere/somewhereelse/ with open("C:/test/test.txt", "a") as file_object: print("Hello, world!", file=file_object) Yes, that works for me with Windows Vista

Re: [Tutor] Hello World in Python without space

2011-07-15 Thread xDog Walker
On Friday 2011 July 15 15:58, Richard D. Moores wrote: > On Fri, Jul 15, 2011 at 14:47, Stefan Behnel wrote: > > Richard D. Moores, 15.07.2011 23:21: > >> What do I do to test.txt to make it "an object with a write(string) > >> method"? > > > > Oh, there are countless ways to do that, e.g. > > > >

Re: [Tutor] Hello World in Python without space

2011-07-15 Thread Richard D. Moores
On Fri, Jul 15, 2011 at 14:47, Stefan Behnel wrote: > Richard D. Moores, 15.07.2011 23:21: >> What do I do to test.txt to make it "an object with a write(string) >> method"? > > Oh, there are countless ways to do that, e.g. > >  class Writable(object): >      def __init__(self, something): >    

Re: [Tutor] Hello World in Python without space

2011-07-15 Thread Stefan Behnel
Richard D. Moores, 15.07.2011 23:21: On Sun, Jul 10, 2011 at 05:05, Peter Otten wrote: >>> help(print) shows print(...) print(value, ..., sep=' ', end='\n', file=sys.stdout) Prints the values to a stream, or to sys.stdout by default. Optional keyword arguments: file: a file-l

Re: [Tutor] Hello World in Python without space

2011-07-15 Thread Richard D. Moores
On Sun, Jul 10, 2011 at 05:05, Peter Otten <__pete...@web.de> wrote: > >>> help(print) > > shows > > print(...) >    print(value, ..., sep=' ', end='\n', file=sys.stdout) > >    Prints the values to a stream, or to sys.stdout by default. >    Optional keyword arguments: >    file: a file-like obje

[Tutor] Filling orders FIFO

2011-07-15 Thread Charles John
Hi I am new to python and was wondering what the best way to create an order(bid and offer) queue, then match a bid and offer so that if bid==offer, creates a filled order FIFO in python cgi using mysql? Does anybody have any ideas? It would be greatly appreciated. Best chuck ___

[Tutor] IDLE/tk in 10.6

2011-07-15 Thread Luke Thomas Mergner
Hi, I am not a professional programmer, but just trying to learn. I'm running Mac 10.6 Snow Leopard. I used MacPorts to install python26, python27, and python3. My python interpreter loads 2.7.2 after I ran the python_select command, which is added via MacPorts I think. I'd like to try IDL