On Wed, 04 Mar 2009 23:28:32 -, Tino Wildenhain
wrote:
Rhodri James wrote:
On Wed, 04 Mar 2009 22:58:38 -, vibgyorbits
wrote:
I'm writing a tool to do some binary file comparisons.
I'm opening the file using
fd=open(filename,'rb')
# Need to seek to 0x80 (hex 80th) location
fd
vibgyorbits writes:
> I'm writing a tool to do some binary file comparisons.
> I'm opening the file using
>
> fd=open(filename,'rb')
>
> # Need to seek to 0x80 (hex 80th) location
>
> fd.seek(0x80)
>
> # Need to read just 8 bytes and get the result back in hex format.
> x=fd.read(8)
> print x
On Tue, 3 Mar 2009 16:47:51 +1100, Python Nutter wrote:
...
> PATH="/Library/Frameworks/Python.framework/Versions/Current/bin:${PATH}"
> export PATH
...
> If you have ever looked at your Mac?s root directory and wondered what
> some of those other directories are for, you?re probably not alone.
>
I just found a well-hidden part of the behaviour you expected.
vibgyorbits writes:
> # Need to read just 8 bytes and get the result back in hex format.
> x=fd.read(8)
> print x
Why would this print the bytes in hex format? “Convert to hexadecimal”
is not the default text encoding for ‘print’.
On Mar 5, 10:51 am, "Rhodri James"
wrote:
> On Wed, 04 Mar 2009 23:28:32 -, Tino Wildenhain
> wrote:
>
>
>
> > Rhodri James wrote:
> >> On Wed, 04 Mar 2009 22:58:38 -, vibgyorbits
> >> wrote:
>
> >>> I'm writing a tool to do some binary file comparisons.
> >>> I'm opening the file us
just curious, it would make writing to a file a bit easier?
--
http://mail.python.org/mailman/listinfo/python-list
On Wed, Mar 4, 2009 at 4:46 PM, ww wrote:
> just curious, it would make writing to a file a bit easier?
Because we have print(), which adds the newline, and most other cases
either involve lists of stuff (so '\n'.join() is used), or the string
comes back from a library and already has newlines,
>> self.sirina = wx.StaticText(self,-1,'Some text that\n will be alignet
>> \nat the right',(200,50),style=wx.ALIGN_RIGHT)
#- this would be an example, the reason I didnt understand
is that I used just one line of text
I understand now. Can I align it on the right withot usi
> Note how get_roulette_wheel() is now completeley independent of the
> concrete problem you are using it for.
Ok, but also a lot more memory consuming ;-)
--
http://mail.python.org/mailman/listinfo/python-list
ww gmail.com> writes:
>
> just curious, it would make writing to a file a bit easier?
Because readline() returns the line with the newline attached, writeline() would
have to require a newline at the. Therefore, it would be equivalent to write()!
Just use f.write("some line\n").
--
http:/
Tino Wildenhain wildenhain.de> writes:
> Rhodri James wrote:
> > for b in x:
> > print hex(ord(b))
> >
>
> better:
>
> print x.encode("hex")
even better:
import binascii
print binascii.hexlify(some_bytes)
--
http://mail.python.org/mailman/listinfo/python-list
Chris Rebert rebertia.com> writes:
> Sidenote: file.writelines() seems very misleadingly named.
Indeed since it is basically a shortcut for f.write("".join(lines)).
--
http://mail.python.org/mailman/listinfo/python-list
vibgyorbits wrote:
I'm writing a tool to do some binary file comparisons.
I'm opening the file using
fd=open(filename,'rb')
> # Need to seek to 0x80 (hex 80th) location
fd.seek(0x80)
# Need to read just 8 bytes and get the result back in hex format.
x=fd.read(8)
print x
This print
On Mar 5, 12:13 pm, Benjamin Peterson wrote:
> Tino Wildenhain wildenhain.de> writes:
>
> > Rhodri James wrote:
> > > for b in x:
> > > print hex(ord(b))
>
> > better:
>
> > print x.encode("hex")
>
> even better:
>
> import binascii
> print binascii.hexlify(some_bytes)
AFAICT binascii.hexlif
On Mar 4, 2009, at 4:44 PM, bruce wrote:
Hi...
Sorry that this is a bit off track. Ok, maybe way off track!
But I don't have anyone to bounce this off of..
I'm working on a crawling project, crawling a college website, to
extract
course/class information. I've built a quick test app in pyt
Tim Chase wrote:
I stumbled across this oddity and was hoping folks on the list might be
able to provide a little understanding:
# swap scalars
>>> x,y = 1,2
>>> x,y = y,x
>>> x,y
(2, 1)
# swap lists
>>> a,b = [1,2,3],[4,5,6]
>>> a,b = b,a
>>> a,b
([4, 5, 6], [1, 2, 3])
# swap list cont
On Wed, 04 Mar 2009 08:00:14 -0800, Paul McGuire wrote:
> On Mar 4, 5:33 am, Lie Ryan wrote:
>> Andre Engels wrote:
>> > y = d.values() might also work, but I am not sure whether d.keys()
>> > and d.values() are guaranteed to use the same order.
>>
>> If they were called immediately after each ot
Hi everyone :o),
this is my first post on the mailing list, so I'll try to be clear
enough. I've on my computer WinXp x64 with python 2.5 and 2.6
installed. When I tried to run a small script using smtplib using Python
2.6, I got that error message:
"
Traceback (most recent call last):
File "<
hi phillip...
thanks for taking a sec to reply...
i'm solid on the test app i've created.. but as an example.. i have a parse
for usc (southern cal) and it exrtacts the courselist/class schedule... my
issue was that i realized the multiple runs of the app was giving differentt
results... in my ca
John Machin lexicon.net> writes:
> On Mar 5, 12:13 pm, Benjamin Peterson wrote:
> >
> > import binascii
> > print binascii.hexlify(some_bytes)
>
> AFAICT binascii.hexlify(some_bytes) gives the SAME result as
> some_bytes.encode("hex") for much more typing -- I see no
> "better"
> here.
So calle
Steven D'Aprano writes:
> Sure, but if you want two lists, as the OP asked for, then you have to
> iterate over it twice either way:
>
> # method 1:
> keys = dict.keys()
> values = dict.values()
>
> # method 2:
> keys, values = zip(*dict.items())
>
> First you iterate over the dict to get the
In article ,
Terry Reedy wrote:
>
>for line in open('char.txt'):
> if line.find('sweet') != -1 or line.find('blue') != -1:
> print(line)
For any recent Python, this should be:
if 'sweet' in line or 'blue' in line:
Although I think that for the OP's use case, it ought to be:
if l
En Thu, 05 Mar 2009 01:48:44 -0200, Xavier Lapointe Desjardins
escribió:
this is my first post on the mailing list, so I'll try to be clear
enough. I've on my computer WinXp x64 with python 2.5 and 2.6
installed. When I tried to run a small script using smtplib using Python
2.6, I got that e
De: "abhinayaraj.r...@emulex.com"
> I am sorry to that I am not able to fully grasp it. Could you help me with
> some more details?
> How can I identify each line and utilize the interactive interpreter?
You really should read the tutorial at http://docs.python.org/tut
(or any other introductor
My well-known-search-engine-foo must be at an all-time low today. *Is*
there an index and I can't see for looking?
regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
Holden Web LLC http://www.holdenweb.com/
Want to know? Come to PyCon - soon! http://us.pyco
bruce wrote:
hi phillip...
thanks for taking a sec to reply...
i'm solid on the test app i've created.. but as an example.. i have a parse
for usc (southern cal) and it exrtacts the courselist/class schedule... my
issue was that i realized the multiple runs of the app was giving differentt
resu
Thank you for the suggestions.
Some little reading gave the idea and it works well too. :)
Here is the code:
fileIN = open("test.txt")
count = 0
for line in fileIN:
data= line
if '' in data:
count = 4
elif '###' in data:
count = 3
andrew cooke wrote:
Delaney, Timothy (Tim) wrote:
Tim Chase wrote:
# swap list contents...not so much...
>>> m,n = [1,2,3],[4,5,6]
>>> m[:],n[:] = n,m
>>> m,n
([4, 5, 6], [4, 5, 6])
[...]
For these types of things, it's best to expand the code out. The
appropriate expansion of:
m,n = [
abhinayaraj.r...@emulex.com writes:
> if '' in data:
> count = 4
> elif '###' in data:
> count = 3
> elif '##' in data:
> count = 2
> elif '#' in data:
> count = 1
> elif data.find('#') == -1:
>
On Wed, 04 Mar 2009 09:04:50 -0800, chuck wrote:
> On Mar 3, 10:40 pm, Marc 'BlackJack' Rintsch wrote:
>> On Tue, 03 Mar 2009 18:06:56 -0800, chuck wrote:
>> > I am learning python right now. In the lesson on tkinter I see this
>> > piece of code
>>
>> > from Tkinter import *
>>
>> > class MyFra
Benjamin Peterson wrote:
John Machin lexicon.net> writes:
On Mar 5, 12:13 pm, Benjamin Peterson wrote:
import binascii
print binascii.hexlify(some_bytes)
AFAICT binascii.hexlify(some_bytes) gives the SAME result as
some_bytes.encode("hex") for much more typing -- I see no
"better"
here.
So
Hello,
It looks that the issue with fetch across rollback still can occur in the new
version. It turned up when I applied the Pysqlite transaction test suite to
some dbapi2 version of my own. Below is a minimal script to reproduce it. It
has puzzled me what goes wrong and I would like to believ
Not sure where to ask this, but how do I edit my PyPI page?
http://pypi.python.org/pypi/LEPL/2.0 doesn't have any text compared to
http://pypi.python.org/pypi/pypp/0.0.2 (selected at random). How do I the
"Benefits", "Drawbacks" etc?
I have clicked around the admin interface, but I only see wha
"Benjamin Peterson" wrote:
>So called encodings like "hex" and "rot13" are abuse of
>encode() method. encode() should translate
>between byte strings and unicode, not preform
>transformations like that. This has been removed
>in 3.x, so you should use binascii.
When all else fails, and just for
"S Arrowsmith" wrote:
> "Small" integers get a similar treatment:
>
> >>> a = 256
> >>> b = 256
> >>> a is b
> True
> >>> a = 257
> >>> b = 257
> >>> a is b
> False
This is weird - I would have thought that the limit
of "small" would be at 255 - the biggest number to
fit in a byte. 256 takes
"Steve Holden" wrote:
> My well-known-search-engine-foo must be at an all-time low today. *Is*
> there an index and I can't see for looking?
>
typing in python weekly at google gives me:
Python-URL!The bookmark for this page is:
http://purl.org/thecliff/python/url.html. Dr. Dobb's Python-URL! -
if it's any help, i have them going back to march 2003 in an imap folder.
i can provide a tarball or similar of a maildir. andrew
Steve Holden wrote:
> My well-known-search-engine-foo must be at an all-time low today. *Is*
> there an index and I can't see for looking?
>
> regards
> Steve
> --
On Jan 14, 10:01 pm, marco.m.peter...@gmail.com wrote:
> I have Python 3.0. I tried to use the 2to3 program included with the
> interpreter to convert some scripts for Python 2.5 to Python 3.0 ones.
> When I try to start it form the Python command line, it says it is a
> syntax error.
>
> This was
101 - 138 of 138 matches
Mail list logo