Re: [SPAM: 3.500] Re: [pygame] This one baffles me
Casey Duncan wrote: Here's the moral-equivalent one-liner in Python: print open("myfile.py").read().replace(" "*4, "\t") Note that this is not exactly the right way to expand tabs, since it doesn't take account of the position in the line at which the block of spaces starts. But it's okay if all you care about is leading indentation. -- Greg
Re: [pygame] problems with fonty.py example
Dnia Sat, 16 May 2009 18:10:55 +0200 Łukasz Wychrystenko napisał(a): > hi all > > I'm trying to run fonty.py(1.8.1) example on standard ubuntu 9.04 > 64bit on python: > Python 2.6.2 (release26-maint, Apr 19 2009, 01:58:18) > [GCC 4.3.3] on linux2 > and > Python 2.5.4 (r254:67916, Apr 4 2009, 17:56:17) > [GCC 4.3.3] on linux2 > > This ended with crash > > more here http://nopaste.org/p/abafwHXAlb . > > br This is weird - error in example :/ just for the next new comers and googlers. replace line font = pygame.font.Font(None, 80) with font = pygame.font.SysFont("Arial", 80)
Re: [pygame] This one baffles me
Here's the moral-equivalent one-liner in Python: print open("myfile.py").read().replace(" "*4, "\t") Note that sed is your friend, however, and you'd be wise to learn it. -Casey On May 17, 2009, at 8:00 AM, Yanom Mobis wrote: I'm sorry, but that script's complete gibberish to me. I was talking about a python script :) --- On Sat, 5/16/09, Łukasz Wychrystenko wrote: From: Łukasz Wychrystenko Subject: Re: [pygame] This one baffles me To: pygame-users@seul.org Date: Saturday, May 16, 2009, 1:55 PM Dnia Sat, 16 May 2009 11:39:12 -0700 (PDT) Yanom Mobis napisał(a): > thanks. anyway, how would i write a script that converts all blocks > of four spaces to tabs? echo infile | sed /s/""/\\t/g ?
Re: [pygame] This one baffles me
str/unicode have an a expandtabs method as well. S.expandtabs([tabsize]) -> string Return a copy of S where all tab characters are expanded using spaces. If tabsize is not given, a tab size of 8 characters is assumed.
Re: [pygame] This one baffles me
thanks --- On Sat, 5/16/09, Tyler Laing wrote: From: Tyler Laing Subject: Re: [pygame] This one baffles me To: pygame-users@seul.org Date: Saturday, May 16, 2009, 1:52 PM Easy: f=open(filename, 'r') text=f.read() text=text.replace('\t', ' ') f.close() f=open(filename, 'w') f.write(text) f.close() Done! On Sat, May 16, 2009 at 11:39 AM, Yanom Mobis wrote: thanks. anyway, how would i write a script that converts all blocks of four spaces to tabs? --- On Fri, 5/15/09, Tyler Laing wrote: From: Tyler Laing Subject: Re: [pygame] This one baffles me To: pygame-users@seul.org Date: Friday, May 15, 2009, 9:54 PM I took a look at main. Apparently the issue was a common python gotcha, mixing up spaces and tabs. Here's the fixed file. -Tyler On Fri, May 15, 2009 at 7:34 PM, Yanom Mobis wrote: my game (attached) just gives a black screen and hangs (has to be shut down with xkill) when started. Is there a problem with the code? -- Visit my blog at http://oddco.ca/zeroth/zblog -- Visit my blog at http://oddco.ca/zeroth/zblog
Re: [pygame] This one baffles me
that makes sense. --- On Sat, 5/16/09, Tyler Laing wrote: From: Tyler Laing Subject: Re: [pygame] This one baffles me To: pygame-users@seul.org Date: Saturday, May 16, 2009, 1:52 PM Easy: f=open(filename, 'r') text=f.read() text=text.replace('\t', ' ') f.close() f=open(filename, 'w') f.write(text) f.close() Done! On Sat, May 16, 2009 at 11:39 AM, Yanom Mobis wrote: thanks. anyway, how would i write a script that converts all blocks of four spaces to tabs? --- On Fri, 5/15/09, Tyler Laing wrote: From: Tyler Laing Subject: Re: [pygame] This one baffles me To: pygame-users@seul.org Date: Friday, May 15, 2009, 9:54 PM I took a look at main. Apparently the issue was a common python gotcha, mixing up spaces and tabs. Here's the fixed file. -Tyler On Fri, May 15, 2009 at 7:34 PM, Yanom Mobis wrote: my game (attached) just gives a black screen and hangs (has to be shut down with xkill) when started. Is there a problem with the code? -- Visit my blog at http://oddco.ca/zeroth/zblog -- Visit my blog at http://oddco.ca/zeroth/zblog
Re: [pygame] This one baffles me
I'm sorry, but that script's complete gibberish to me. I was talking about a python script :) --- On Sat, 5/16/09, Łukasz Wychrystenko wrote: From: Łukasz Wychrystenko Subject: Re: [pygame] This one baffles me To: pygame-users@seul.org Date: Saturday, May 16, 2009, 1:55 PM Dnia Sat, 16 May 2009 11:39:12 -0700 (PDT) Yanom Mobis napisał(a): > thanks. anyway, how would i write a script that converts all blocks > of four spaces to tabs? echo infile | sed /s/" "/\\t/g ?