rs is handling malformed html.
Beautiful Soup is intended to handle malformed HTML and seems to do
pretty well.
Kent
--
http://mail.python.org/mailman/listinfo/python-list
I V wrote:
> Incidentally, does python have a built-in to do a binary search on a
> sorted list? Obviously it's not too tricky to write one, but it would be
> nice if there was one implemented in C.
See the bisect module.
Kent
--
http://mail.python.org/mailman/listinfo/python-list
Python 2.4.2 (#1, Nov 29 2005, 14:04:55)
[GCC 3.2.2 20030222 (Red Hat Linux 3.2.2-5)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> d = "/home/testuser/projects"
>>> os.path.basename(d)
'projects'
>>> os.path.dirname(d)
'/home/testuser'
>>>
--
on of the loop. (Though you
will need a separate test to terminate the loop when there are no more
lines.)
You can iterate an open file directly; here is a shorter version:
for line in open('test.dat'):
line = line.rstrip('\n')
if line:
print line
Kent
>
Gary Wessle wrote:
> ps. is there a online doc or web page where one enters a method and it
> returns the related docs?
The index to the library reference is one place:
http://docs.python.org/lib/genindex.html
and of course help() in the interactive interpreter...
Kent
--
d =ffgtyuf == =tyryr =u=p ff"
In [3]: re.sub('=.', '=#', s)
Out[3]: 'tyrtrbd =#fgtyuf =# =#yryr =#=# ff'
If the replacement char is not fixed then make the second argument to
re.sub() be a callable that computes the replacement.
PS str is not a good name
> systems.
One of these might be helpful:
http://developer.berlios.de/projects/plugboard/
http://termie.pbwiki.com/SprinklesPy
Kent
--
http://mail.python.org/mailman/listinfo/python-list
strophe character in another
> character set? If so, which character set?
\x92 is a right single quote in Windows cp1252.
http://www.microsoft.com/globaldev/reference/sbcs/1252.mspx
Kent
--
http://mail.python.org/mailman/listinfo/python-list
again which just moved the
> ugliness to another position.
This is fine. You don't need 'global' statements to read global
variables, function1() can be simply
def function1():
print debugFlag
Kent
--
http://mail.python.org/mailman/listinfo/python-list
paragraph + '\n\n'"
In [20]: re.sub(r"'' \+ (.*?) \+ '\n\n'", r"'%s\n\n' %
\1", test)
Out[20]: "self.source += '%s\n\n' % paragraph"
Kent
--
http://mail.python.org/mailman/listinfo/python-list
inations for hints).
Filter with the regex. Halting is left as an exercise for the reader.
(Halting when the length reaches a predetermined limit would be one way
to do it.)
Kent
--
http://mail.python.org/mailman/listinfo/python-list
John Salerno wrote:
> Call
> me crazy, but I'm interested in regular expressions right now. :)
Not crazy at all. REs are a powerful and useful tool that every
programmer should know how to use. They're just not the right tool for
every job!
Kent
--
http://mail.python.org/
se.
>
> This software tool needs to work on a variety of different computers; Win95,
> Win98, WinXP, Mac, Linux.
Take a look at Tkinter, it is pretty easy to get started with and good
for making simple GUIs. Look at the csv module for writing the data to
files.
Kent
--
http://mail.python.org/mailman/listinfo/python-list
art = 0
while True:
m = pattern.search(string, start)
if not m: break
ans.append( (m.start(), m.end()) )
start = m.start() + 1
print ans # => [(0, 2), (2, 4), (4, 6), (6, 8), (8, 10), (10, 12), (12, 14)]
Kent
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] wrote:
> Sure, are there any available simulators...since i am modifying some
> stuff i thought of creating one of my own. But if you know some
> exisiting simlators , those can be of great help to me.
http://simpy.sourceforge.net/
--
http://mail.python.org/mailman/listinfo/pyth
sage explaining what is wrong.
I would just use the file normally in the test. If it's not there you
will get an IOError with a traceback and a helpful error message.
Kent
--
http://mail.python.org/mailman/listinfo/python-list
k a little harder:
for f in path.path('.\InteropSolution').walkfiles():
if f.fnmatch('*.dll') or f.fnmatch('*.exe'):
print f
or maybe
for f in path.path('.\InteropSolution').walkfiles():
if f.ext in ['.dll', '.exe']:
print f
http://www.jorendorff.com/articles/python/path/index.html
Kent
--
http://mail.python.org/mailman/listinfo/python-list
Alternately you can use an attribute of the function to save the state:
In [35]: def f(a):
: f.b += a
: return f.b
:
In [36]: f.b=1
In [37]: f(1)
Out[37]: 2
In [38]: f(2)
Out[38]: 4
Kent
--
http://mail.python.org/mailman/listinfo/python-list
rrent/doc/misc.html#the-py-std-hook
Kent
--
http://mail.python.org/mailman/listinfo/python-list
tribute, not a class attribute. You need to
refer to self._listbox_1 from a CustomFront method, or change _listbox_1
to a class attribute if that is what you really want.
Kent
--
http://mail.python.org/mailman/listinfo/python-list
When you did:
b = a[:]
b was then a copy of a, rather than just a reference to the same a.
But what does a contain? It contains two sublists -- that is, it
contains references to two sublists. So b, which is now a copy of a,
contains copies of the two references to the same two sublists.
What y
softwindow wrote:
> the re module is too large and difficult to study
>
> i need a detaild introduction.
>
http://www.amk.ca/python/howto/regex/
Kent
--
http://mail.python.org/mailman/listinfo/python-list
mething like this?
out = None
for line in open(...):
if line.startswith('H'):
if out:
out.close()
out = open(..., 'w')
if out:
out.write(line)
out.close()
Kent
--
http://mail.python.org/mailman/listinfo/python-list
Can anyone point me to a GUI program that allows viewing and browsing
the output of the profiler? I know I have used one in the past but I
can't seem to find it...
Thanks,
Kent
--
http://mail.python.org/mailman/listinfo/python-list
ting it seems to depend on from which partition I
> start Python.
Probably you have multiple copies of selfservicelabels.py or an old
selfservicelabels.pyc that is being imported. Try
import selfservicelabels
print selfservicelabels.__file__
to see where the import is coming from.
Kent
manstey wrote:
> Hi,
>
> How do I convert a string like:
> a="{'syllable': u'cv-i b.v^ y^-f', 'ketiv-qere': 'n', 'wordWTS': u'8'}"
>
> into a dictionary:
> b={'syllable': u'cv-i b.v^ y^-f', 'ketiv-qere': 'n', 'wordWTS': u'8'}
Try this recipe:
http://aspn.activestate.com/ASPN/Cookbook/Python/Reci
er instead of just the typical [A-Z],
> which doesn't include, for example É. Is there a way to do this, or
> do I have to stick with using the isupper method of the string class?
>
See http://tinyurl.com/7jqgt
Kent
--
http://mail.python.org/mailman/listinfo/python-list
Zameer wrote:
> I wonder where the "else" goes in try..except..finally...
>
try / except / else / finally
See the PEP:
http://www.python.org/dev/peps/pep-0341/
Kent
--
http://mail.python.org/mailman/listinfo/python-list
If anyone is successfully compiling Pyton 2.3 on an SCO OpenServer 5
box, I'd appreciate hearing from you on how you managed to do it. So
far, I'm unable to get a python that doesn't coredump.
--
http://mail.python.org/mailman/listinfo/python-list
I need to compile Python on OpenServer 5 because I need to 'freeze'
our Python app, and running 'freeze' requires a working, compilable
source installation of Python.
--
http://mail.python.org/mailman/listinfo/python-list
for membership in a set is much faster
than searching a large list.
- Find a better algorithm ;)
Kent
--
http://mail.python.org/mailman/listinfo/python-list
existing dictionaries only using
JPython libraries.
How do you access the dictionary files from Python? The same thing may
work in Jython. For example importing the file, if it is Python syntax,
should work in Jython; also I think format 0 (text) and format 1 pickles
are compatible with Jython.
Kent
these.
You need a topological sort.
http://en.wikipedia.org/wiki/Topological_sort
Two Python implementations:
http://pypi.python.org/pypi/topsort/0.9
http://www.bitformation.com/art/python_toposort.html
Kent
--
http://mail.python.org/mailman/listinfo/python-list
On Jan 23, 9:03 am, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
> print "foo"
> print "bar"
>
> has a newline in between "foo" and "bar"
>
> print "foo",
> print "bar"
>
> has a space in between "foo" and "bar"
>
> How prevent ANYTHING from going in between "foo" and "bar" ??
>
> (Without defini
It's often useful for debugging to print something to stderr, and to
route the error output to a file using '2>filename' on the command
line.
However, when I try that with a python script, all prompt output from
raw_input goes to stderr. Consider the following test program:
=== Start test.py ===
Gabriel, thank you for clarifying the source of this behavior. Still,
I'm surprised it would be hard-coded into Python. Consider an
interactive program, that asks the user several questions, and
displays paragraphs of information based on those questions. The
paragraphs are output using print, a
> If it weren't for the documentation...
>
> "If the prompt argument is present, it is written to *standard output*
> without a trailing newline."
>
> --
> mvh Björn
I have reported this issue to the python-dev mailing list, and Guido
agrees that this is a bug in Python. It turns out that the ke
On Jan 24, 5:13 pm, "Terry Reedy" <[EMAIL PROTECTED]> wrote:
> "Ben Finney" <[EMAIL PROTECTED]> wrote in message
>
> news:[EMAIL PROTECTED]
> | Mike Kent <[EMAIL PROTECTED]> writes:
> |
> | > A bug issue has been opened in the Python Trac
On Jan 26, 7:23 am, Dox33 <[EMAIL PROTECTED]> wrote:
> I ran into a very strange behaviour of raw_input().
> I hope somebody can tell me how to fix this.
===CUT===
> *** Thirst, redirect stderr to file, STRANGE behaviour..
> From the command prompt I run:
> python script.py 2> stderr_catch.txt
In a comment Guido made on a recent bug report for the 'freeze'
utility, he stated:
"I think nobody really cares about freeze any more -- it isn't
maintained."
That being the case, what is the preferred/best replacement for freeze
on a *nix platform? I'm looking for something that, like freeze,
> So my question is this - what is the easiest way to interface to this
> "serial" device?
>
http://pyserial.sourceforge.net/
or perhaps
http://pyusb.berlios.de/
--
http://mail.python.org/mailman/listinfo/python-list
On Feb 2, 6:40 pm, Baris Demir wrote:
> def simpleCut(d=dict()):
> temp=d
> for i in temp.keys():
> if (temp[i] == ...) :
> temp[i]=new_value
> return temp
You have been bitten by the shared default parameter noobie trap:
http://www.python.org/doc/fa
I use Fabric (http://www.nongnu.org/fab/) as my Python-based
deployment tool, but it uses ssh/scp, not sftp.
--
http://mail.python.org/mailman/listinfo/python-list
I'm having a problem building the Python 2.5.2 curses module on HP/UX
11.11 using gcc 3.3.6, and was hoping someone had a solution.
Compiling Modules/_cursesmodule.c is giving several warnings, but no
errors. The relevant compile/link output is below. The key output
line is:
*** WARNING: renamin
It makes the build pretty much useless
> for anyone needing it to run Tkinter apps, including Idle. I'd say
> it's
> a showstopper issue.
I think so.
Kent
--
http://mail.python.org/mailman/listinfo/python-list
> I have done script for that, but im having problem with croatian characters
> >> (©,Ð,®,È,Æ).
>
> UnicodeDecodeError: 'utf8' codec can't decode byte 0x9e in position 0:
> unexpected code byte
Are you sure you have UTF-8 data? I guess your file is encoded in
CP125
Before I file a bug report against Python 2.5.2, I want to run this by
the newsgroup to make sure I'm not being stupid.
I have a text file of fixed-length records I want to read in random
order. That file is being changed in real-time by another process,
and my process want to see the changes to
To followup on this:
Terry: Yes, I did in fact miss the 'buffer' parameter to open.
Setting the buffer parameter to 0 did in fact fix the test code that I
gave above, but oddly, did not fix my actual production code; it
continues to get the data as first read, rather than what is currently
on the
I'd like to ship only the .pyc files for a module. I was hoping the
standard distutils setup.py could handle this, but so far, I've not
figured out how.
After a bit of work, I discovered that if I create a MANIFEST.in file,
and put 'include mymodule/*.pyc' and 'exclude mymodule/*.py' in it,
then
, in
win_message_to_event
kind, button = win_message_map[msg]
KeyError: 675
Adding this line to win_message_map in GUI/Win32/Events.py seems to
fix it:
wc.WM_MOUSELEAVE: ('mouse_leave', None),
Kent
--
http://mail.python.org/mailman/listinfo/python-list
On Apr 27, 1:49 am, John Machin wrote:
> > I am
> > having a look at eval and exec
>
> WRONG WAY
> GO BACK
+1 QOTW
--
http://mail.python.org/mailman/listinfo/python-list
On May 13, 2:39 pm, Georgy Panterov <[EMAIL PROTECTED]> wrote:
>
> def deal_hand(deck):
> HAND=[]
> for _ in range(2):
> i=random.randint(0,len(deck)) #produces a random card from the deck
^ Here i can be from 0 thru (the number of cards in the
deck).
> HAND.appen
On Jun 3, 6:11 pm, [EMAIL PROTECTED] wrote:
> Hello all,
>
> I have come across this issue in Python and I cannot quite understand
> what is going on.
>
> class Param():
> def __init__(self, data={}, condition=False):
> if condition:
> data['class']="Advanced"
> prin
For Python 2.5 and new-style classes, what special method is called
for mylist[2:4] = seq and for del mylist[2:4] (given that mylist is a
list, and seq is some sequence)?
I'm trying to subclass list, and I'm having trouble determining what
special methods I have to override in my class for the abo
On Jun 13, 8:43 pm, Matimus <[EMAIL PROTECTED]> wrote:
...chop...
> So, it looks like as long as you want to subclass list, you are stuck
> implementing both __*slice__ and __*item__ methods.
>
> Matt
Thanks. That was clear and concise, just what I needed.
--
http://mail.python.org/mailman/listi
I recently wanted to do the same kind of thing. See this tread:
http://groups.google.com/group/comp.lang.python/browse_thread/thread/f27c3b7950424e1c
for details on how to do it.
--
http://mail.python.org/mailman/listinfo/python-list
On Jul 1, 2:49 pm, "Brandon" <[EMAIL PROTECTED]> wrote:
> How do I convert a string to a char array? I am doing this so I can edit
> the string received from an sql query so I can remove unnecessary
> characters.
Answering your specific question:
Python 2.5.1 (r251:54863, Mar 31 2008, 11:09:52)
Howdy,
I want to open an xterm, send it a command and have it execute it.
I thought pexpect would do this, but I've been unsuccessful.
term = pexpect.spawn('xterm')
starts an xterm, but
term.sendline('ls')
doesn't seem to do anything.
Suggestions?
Thanks,
K
Derek Martin pizzashack.org> writes:
>
> On Fri, Aug 08, 2008 at 08:25:19PM +0000, Kent Tenney wrote:
> > Howdy,
> >
> > I want to open an xterm, send it a command and have it execute it.
>
> You can't do that. xterm doesn't execute shell com
Derek Martin pizzashack.org> writes:
>
> On Fri, Aug 08, 2008 at 08:25:19PM +0000, Kent Tenney wrote:
> > Howdy,
> >
> > I want to open an xterm, send it a command and have it execute it.
>
> You can't do that. xterm doesn't execute shell com
Howdy,
I have not found a routine to extract usable
date/time information from the 60 bit uuid1 timestamp.
Is there not a standard solution?
Thanks,
Kent
--
http://mail.python.org/mailman/listinfo/python-list
> Howdy,
>
> I have not found a routine to extract usable
> date/time information from the 60 bit uuid1 timestamp.
>
> Is there not a standard solution?
I submitted an ASPN recipe to do it.
http://code.activestate.com/recipes/576420/
--
http://mail.python.org/mailman/listinfo/python-list
name annotate from /usr//image.pyc
Thanks,
Kent
--
http://mail.python.org/mailman/listinfo/python-list
creation
date solely from the filename.
Thanks,
Kent
--
http://mail.python.org/mailman/listinfo/python-list
int: you have to modify import_from function from
> > Python/ceval.c
Am I correct in thinking that PyPy would mean low level
stuff like this will be Python instead of C?
That would be nice.
> >
> > My quick attempt:
Quick indeed!
Very cool.
Thanks,
Kent
--
http://mail.python.org/mailman/listinfo/python-list
On Apr 16, 10:26 am, Mike Driscoll <[EMAIL PROTECTED]> wrote:
> Yeah, I noticed that Google Groups has really sucked this week. I'm
> using the Google Groups Killfile for Greasemonkey now and it helps a
> lot. I like Google, but my loyalty only goes to far. This is a
> complete lack of customer se
You could use http://docs.python.org/lib/module-optparse.html
--
http://mail.python.org/mailman/listinfo/python-list
On May 2, 9:47 am, Jetus <[EMAIL PROTECTED]> wrote:
> Hello Marc;
> Thanks for the input! I am worried about the comma in the "" data
> items, how do I tell Python to look for the "" data first, then use
> the comma separator?
Marc has already given you the correct answer. You really should read
On Aug 27, 9:35 am, brad <[EMAIL PROTECTED]> wrote:
> Recently had a need to us a multimap container in C++. I now need to
> write equivalent Python code. How does Python handle this?
>
> k['1'] = 'Tom'
> k['1'] = 'Bob'
> k['1'] = 'Joe'
> ...
>
> Same key, but different values. No overwrites either
On Aug 29, 2:28 pm, [EMAIL PROTECTED] wrote:
> Sorry : Earlier mail had a typo in Subject line which might look
> in-appropriate to my friends
>
> Hi,
>
> I've a list some of whose elements with character \.
> I want to delete this last character from the elements that have this
> character set at
cuting I am getting error message as follows
>
> Traceback (most recent call last):
> File "", line 1, in ?
> NameError: name 'octal' is not defined
The correct name is oct(). The docs on built-in functions are helpful here:
http://docs.python.org/lib/built-in-funcs.html
Kent
--
http://mail.python.org/mailman/listinfo/python-list
ld.
Python 2.5 will allow this (see PEP 342) but from the examples it seems
the finally won't execute until the yield returns.
Kent
--
http://mail.python.org/mailman/listinfo/python-list
Set the Location: header to the new URL.
http://hoohoo.ncsa.uiuc.edu/cgi/out.html
http://www.algonet.se/~ug/html+pycgi/redirect.html
Kent
--
http://mail.python.org/mailman/listinfo/python-list
ell me where somemodule was coming from (should I need to
> be reminded of that information).
If you use from xx import yy, searching for yy will show you its
provenance as well.
From xx import * is evil because it does hide the provenance of names.
It can also give unexpected results - if xx
Paul Rubin wrote:
> Tim Roberts <[EMAIL PROTECTED]> writes:
>
>>Yes, but the CGI module doesn't write anything, so the advice of writing a
>>"Location:" header still applies.
>
>
> Aha, it's coming from CGIHTTPServer.py:CGIHTTPRequestHandler.run_cgi()
> where it says
>
> self.send_respo
the raw creation time %(created)f rather than
%(asctime)s in your format.
Kent
--
http://mail.python.org/mailman/listinfo/python-list
Ravi Teja wrote:
> I do not think that technology has gone backwards. Hyper card
> alternatives still exist.
> http://www.metacard.com/
At $995 per seat it's not likely to be used for a home project.
Kent
--
http://mail.python.org/mailman/listinfo/python-list
r me just to search for FOO, and then
> break up the string based on the locations of FOO.
Use re.split() for this.
Kent
--
http://mail.python.org/mailman/listinfo/python-list
Paul Rubin wrote:
> So what's the most concise way
> of turning it back into a string? ''.join(list(reversed(a_string))) ?
You don't need the list(), join() can take an iterator:
''.join(reversed(a_string))
Kent
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] wrote:
> Hello again,
> I am disappointed. You are the experts, you've got to try harder ;-)
> What i want is a generalisation of this tiny function:
Why? Maybe we can find a better way...
Kent
--
http://mail.python.org/mailman/listinfo/python-list
quot;, "credits" or "license" for more information.
In [1]: import locale
In [2]: locale.nl_langinfo(locale.MON_1)
Traceback (most recent call last):
File "", line 1, in ?
AttributeError: 'module' object has no attribute 'nl_langinfo'
Kent
--
http://mail.python.org/mailman/listinfo/python-list
nt Errors and Exceptions, and have the
> program deal with them gracefully.
All the ConfigParser exceptions are subclasses of ConfigParser.Error so
if you catch that instead of ConfigParser.ParsingError your code will
catch NoSectionError as well.
Kent
--
http://mail.python.org/mailman/listinfo/python-list
clause
by putting them in a tuple:
except (IOError, Error), err:
print "Problem opening configuration file. %s" %err
HTH
Kent
--
http://mail.python.org/mailman/listinfo/python-list
Jacob wrote:
> How do I install Universal Encoding Detector
> (http://chardet.feedparser.org/)?
The usual process:
download
unpack with your favorite tool - tar or WinZip, maybe
cd chardet-1.0
python setup.py install
Kent
--
http://mail.python.org/mailman/listinfo/python-list
Jacob wrote:
> How do I uninstall?
Delete the chardet folder from site-packages (Python24\Lib\site-packages
on Windows, not sure of the exact path on other OS's).
Kent
--
http://mail.python.org/mailman/listinfo/python-list
) yields a sequence of the
lengths of the individual animals; passing this to sum() gives the total
count.
Kent
--
http://mail.python.org/mailman/listinfo/python-list
omething as
simple as
def foo(): pass
can raise KeyboardInterrupt
Kent
--
http://mail.python.org/mailman/listinfo/python-list
453 (u=3)
You don't say what data you are trying to extract. If it is key:value
pairs where the key is everything before the first colon, just use
line.split(':', 1) to split on just the first colon.
Kent
--
http://mail.python.org/mailman/listinfo/python-list
John Machin wrote:
> I am pleased to announce a new general release (0.5.2) of xlrd, a Python
> package for extracting data from Microsoft Excel spreadsheets.
How does xlrd compare with pyexcelerator? At a glance they look pretty
similar.
Thanks,
Kent
--
http://mail.python.org/mailman/li
for msg in messagesInfo:
> msgNum = int(split(msg, " ")[0]
> msgSize = int(split(msg, " ")[1]
You have an inconsistent indent in the two lines above. All the lines in
a block must have the same indent (except sub-blocks of course).
Kent
--
http://mail.python.org/mailman/listinfo/python-list
John Machin wrote:
> On 19/03/2006 8:31 AM, Kent Johnson wrote:
>>How does xlrd compare with pyexcelerator? At a glance they look pretty
>>similar.
>>
>
> I have an obvious bias, so I'll just leave you with a not-very-PC
> analogy to think about:
>
&g
e to the thing called 'stdout' and how you read from 'stdin'.
raw_input() prompts to stdout and reads from stdin. print outputs to stdout:
In [53]: print raw_input('What is your name? ')
What is your name? Kent
Kent
or import sys and use sys.stdin and sys.stdout.
Kent
--
http://mail.python.org/mailman/listinfo/python-list
work correctly because the 'and' will always evaluate to
"" which is False so the last term will be evaluated and returned:
a = (a == "yes") and "" or "stop"
and IMO the extra syntax needed to fix it isn't worth the trouble; just
spell out the if / else.
Kent
--
http://mail.python.org/mailman/listinfo/python-list
John Machin wrote:
> On 19/03/2006 2:30 PM, Kent Johnson wrote:
>>That didn't shed much light. I'm interested in your biased opinion,
>>certainly you must have had a reason to write a new package.
>
> * It's not new. First public release was on 2005-05-15.
e
count. I expect Paul Rubin's solution will be dramatically faster for
large lists as it only iterates str_list once.
Kent
--
http://mail.python.org/mailman/listinfo/python-list
anguages write x^y instead of x**y).
The way to make this change happen is to submit a bug report with your
suggested change. See the link at the bottom of the above page to find
out how.
Kent
--
http://mail.python.org/mailman/listinfo/python-list
correct files into site-packages.
Kent
--
http://mail.python.org/mailman/listinfo/python-list
openness
> function ? Do I have to separate the code into smaller functions ?
Yes. The profiler collects statistics for functions, not for individual
lines of code.
Kent
--
http://mail.python.org/mailman/listinfo/python-list
d longs sent from C into Python
> through a socket.
>
>Suppose I know I am getting 34 bytes, and the last 6 bytes are a 2-byte
> word followed by a 4-byte int, how can I be assured that it will be in that
> format?
>
>In a test, I am sending data in this format:
> PACK_FORMAT = "HHHI"
> which is 34 bytes
Are you sure? Not for me:
In [9]: struct.calcsize('HHHI')
Out[9]: 36
Kent
--
http://mail.python.org/mailman/listinfo/python-list
it("45", 1)[-1]
'6789'
>>
>># if not found, return whole string
>>
>>>"hello, world !".upto("#")
>>
>>"hello, world !"
"hello, world !".split("#", 1)[0]
'hello, world !'
>>
>>>u"hello, world !".from("#")
>>
>>u"hello, world !"
"hello, world !".rsplit("#", 1)[-1]
'hello, world !'
Kent
--
http://mail.python.org/mailman/listinfo/python-list
601 - 700 of 792 matches
Mail list logo