Hi all, I do apologise for this,
This was an email that has nothing to do with Python or the tutor
list, so my apologies to all. Somehow I managed to send it to the
wrong recepient.
(And my thanks to Bob for being brave enough to attempt to answer what
would be a hopelessly vague question. :-) )
Don Taylor wrote:
> Finally, are there any other possible file extension types that I should
> be looking at?
.pyo is like a .pyc but compiled with optimizations on.
Kent
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/
Terry Carroll wrote:
>>How can I tell if a .pyc file was built with 2.3 or 2.4?
>
>
> There's a "Magic Number" in the first 2 or 4 bytes, (depending on whether
> you consider the \r\n part of the MN).
>
>
f = open("pycfile.pyc", "rb")
magictable = {'\x3b\xf2\r\n': "2.3", '\x6d\xf2\r\n
On 20/04/06, Carroll, Barry <[EMAIL PROTECTED]> wrote:
> The following code fragment does the job but seems sort of brutish and
> inelegant to me:
>
> >>>
> >>> s = '987654321'
> >>> odd = ''
> >>> for c in s[::-2]:
> ... odd = c + odd
> ...
> >>>
String slicing will actually produce stri
Greetings:
I am writing a function that accepts a string of decimal digits, calculates a
checksum and returns it as a single character string.
The first step in the calculation is to split the input into two strings: the
even- and odd- numbered digits, respectively. The least significant digi
> I cannot for the life of me figure out a pythonic way (read: using the
> split() builtin) to scan for instances of these characters in such and
> such
> order and proximity. I know this is what regex is for,
I'm afraid so, it looks like the time has come to import re.
> I have obtained a copy
> How can I do to access this file whatever the user is ?
>
> use os.path.expanduser(path)
Neat Wesley, I've never noticed that one before.
Alan G.
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
Hi,
The categories of calls under this drop down box, are they going to
increase anytime soon, or shall I go with what's there?
Regards,
Liam Clarke
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
Hi Doug,
Best tip ever is your_python_dir\tools\scripts\redemo.py
Interactive regexes. :)
This is pretty good as well - http://www.amk.ca/python/howto/regex/
Good luck,
Liam Clarke
On 4/20/06, doug shawhan <[EMAIL PROTECTED]> wrote:
> I think I'm going to have to suck it up and learn some reg
I think I'm going to have to suck it up and learn some regular expressions.
I have finally gotten my script (using the excellent pyserial module)
to behave. Most of my troubles as enumerated here before were utterly
self-induced. Apparently one cannot watch the execution of one's script
through an
Hmm? How so? I'm using a whole lot of raw wxPython mixed with
Pythoncard for a project, and the entire process sits at 7Mb RAM usage
idle. WinXP btw.
Considering my small command line appns to start/stop Windows services
written in C use just over 1Mb, 7Mb isn't overly bad.
The other good thing a
>> If I can get it for free, I might as well go with say wxPython. Thanks
> Yes, free as in beer, as in speech, and cross platform. Oh, and better
> documented.
Sadly, you still pay for it in RAM usage :^)
Alan
___
Tutor maillist - Tutor@python.org
we are all happy to help. it is really good that you were able to get
it working so fast! also, if you want to do any kind of pattern
matching with * or ?, then check out the "glob" module.
merci! "le livre" does not look that good from here... it is a mess
and i have to clean it up before givi
> The ".myapp.conf" is in the home folder of the user.
> ...
> obviously I won't know the home user folder name then I wanted to use:
> How can I do to access this file whatever the user is ?
You can get the user name using getpass.getuser() as described in
the OS topic of my tutor under the Secu
Hi,
You can use expanduser() from os.path for this:
import os.path
homedir = os.path.expanduser('~user1')
file_to_open = os.path.join(homedir, '.myapp.conf')
f = open(file_to_open, 'r')
Regards,
-Markus-
Quoting learner404 <[EMAIL PROTECTED]>:
> Hello,
>
> I want to read a configuration fi
It works great, thanks very much to the three of you for these light-speed answers ... I love this list !
Wesley, I've just pre-order your new edition "Core Python programming" on amazon France, it looks great. :)
Thanks
On 19/04/06, w chun <[EMAIL PROTECTED]> wrote:
> f=open("~/.myapp.conf",
> I tried:
>
> class Omega:
>def Display(self):
>print self
>
> class Alpha(Omega):
>def __init__(self):
>self = Beta()
>
> class Beta(Omega):
>def __init__(self):
>pass
>
> objectus = Alpha()
> objectus.Display()
>
> which prints
>
> <__main__.Alpha instance at
> f=open("~/.myapp.conf","r") # but it returns a IOError: [Errno 2] No such
> file or directory:
>
> How can I do to access this file whatever the user is ?
use os.path.expanduser(path)
http://www.python.org/doc/2.4.3/lib/module-os.path.html
hope this helps!
-- wesley
- - - - - - - - - - - -
os.getenv('HOME') will return the user's home directory as long as that
environment variable is set.
you can also use the pwd module:
>>> pwd.getpwnam('mtw')
('mtw', 'x', 1000, 1000, ',,,', '/home/mtw', '/bin/bash')
-mtw
On Wed, Apr 19, 2006 at 07:55:14PM +0200, learner404 ([EMAIL PROTECTED]) w
Hello,
I want to read a configuration file from a small python app (user preferences).
The ".myapp.conf" is in the home folder of the user.
if I do:
f=open("/home/user1/.myapp.conf","r") #it works
obviously I won't know the home user folder name then I wanted to use:
f=open("~/.myapp.conf","
> Ok,
> If I can get it for free, I might as well go with say wxPython. Thanks
Yes, free as in beer, as in speech, and cross platform. Oh, and better
documented.
Hugo
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
class SOFileIndexRecord(object):
def __init__(self, so):
self._so=so
def _get_code(self):
return self._so.code
def _set_code(self, value):
self._so.code=value
testCode=property(_get_code, _set_code) # What does this do?
It says that testCode is a property o
> is it correct that an object cannot be re-instantiated within it's
> __init__ method?
There are some tricks you can pull but the object is actually instantiated
before the init gets called. Really init is for initialisation of the
instance,
it's not a true constructor.
> Background: I need to
Thank you Michael, Danny and Alan for your suggestions.
I've included below my summary of the three very different
suggestions, my brief analysis of them, and my conclusion.
Anyone is free and welcome to comment!
On 4/18/06, Andre Roberge <[EMAIL PROTECTED]> wrote:
> Hi all-
>
> Suppose I had a fu
class SOFileIndexRecord(object): def __init__(self, so): self._so=so def _get_code(self): return self._so.code def _set_code(self, value): self._so.code=value
testCode=property(_get_code, _set_code) # What does this do? def _get_fileName(self): re
Contained in a reply about a Google calendar issue...
> http://www.google.com/support/calendar/bin/answer.py?answer=37083&query=free+busy&topic=0&type=f
>
Note the answer.py
Looks like Google have expanded their use of Python from test scripts and
config/admin to mainstream web pages, albeit the
On Wed, Apr 19, 2006 at 09:10:41PM +0530, Kaushal Shriyan ([EMAIL PROTECTED])
wrote:
> Thanks Matthew
> Just wanted to know
> x.count('l') -> 2 Here 2 means what I didnot understood this
> and also does x is a object and capitalize(), swapcase() and
> count('l') are methods, is that correct what
On 4/19/06, Matthew White <[EMAIL PROTECTED]> wrote:
> Even though I am still new to python, I've recently had an insight as
> to what makes OOP different from procedural programming.
>
> Let's take perl for example. A variable in perl is like a bowl. It's an
> empty vessel you can put things in.
Even though I am still new to python, I've recently had an insight as
to what makes OOP different from procedural programming.
Let's take perl for example. A variable in perl is like a bowl. It's an
empty vessel you can put things in. You can change the contents of
the bowl, you can empty the b
Jan Eden wrote:
> Hi,
>
> is it correct that an object cannot be re-instantiated within it's __init__
> method?
>
> I tried:
>
> class Omega:
> def Display(self):
> print self
>
> class Alpha(Omega):
> def __init__(self):
> self = Beta()
>
> class Beta(
Hi,
is it correct that an object cannot be re-instantiated within it's __init__
method?
I tried:
class Omega:
def Display(self):
print self
class Alpha(Omega):
def __init__(self):
self = Beta()
class Beta(Omega):
def __init__(self):
pass
It's a dual license. If you use Qt in non-commercial software, the GPL
applies and you pay no licensing fees. If you use Qt in commercial
software, licensing fees are due to TrollTech.
Chris
On 4/18/06, Alan Gauld <[EMAIL PROTECTED]> wrote:
> [snip]
> TrollTech own Qt, their licensing arrangement
Hi All
I wanted to understand about OOPs Concept in Python in a easy way,
Please explain me with an example
I have been reading http://www.freenetpages.co.uk/hp/alan.gauld/tutclass.htm
but at the moment still the concept is not clear
Thanks in Advance
Regards
Kaushal
__
>> *
> i want to write a function which will sort the sentence by the length of
> each word in the sentece, short length first.please help.
Hi Nywbon,
First: please do not reply to the whole email digest. The point of a
reply is to continue a previous conver
On Wed, 19 Apr 2006, Andre Engels wrote:
> 2006/4/18, Danny Yoo <[EMAIL PROTECTED]>:
>
>> H Can you send a link to the text that's causing performance
>> issues? It might be possible that someone here might isolate the
>> performance problem. (Hey, it happened before with BeautifulSoup
2006/4/18, Danny Yoo <[EMAIL PROTECTED]>:
> H Can you send a link to the text that's causing performance
> issues? It might be possible that someone here might isolate the
> performance problem. (Hey, it happened before with BeautifulSoup...
> *grin*)
I have sent the text (and another t
Quoting [EMAIL PROTECTED]:
> Send Tutor mailing list submissions to
> tutor@python.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
> http://mail.python.org/mailman/listinfo/tutor
> or, via email, send a message with subject or body 'help' to
> [EMAIL PROTECTED]
37 matches
Mail list logo