On Jan 3, 9:39 am, [EMAIL PROTECTED] wrote:
> Hopefully this isn't too OT.
>
> One thing I like about comp.lang.python is the breadth of topics
> discussed here. People can ask about Python installation and
> configuration issues on specific platforms, compare third party
> libraries, ask for book
On Jan 4, 6:24 am, Ramashish Baranwal <[EMAIL PROTECTED]>
wrote:
> Hi,
>
> I am trying to read a csv file using csv.reader. The file is created
> using Open Office and saved in Excel format.
>
> import csv
>
> reader = csv.reader(open('test.xls'))
> for row in reader:
> print row
>
> It however
import linecache
import glob
# reading from one file
print linecache.getline('notes/python.txt',4)
'http://www.python.org/doc/current/lib/\n'
# reading from many files
for filename in glob.glob('/etc/*'):
print linecache.getline(filename,4)
jo3c wrote:
> hi everyone happy new year!
> im a
-On [20080104 04:11], Alaric ([EMAIL PROTECTED]) wrote:
>Unfortunately, the only site (forge.nesc.ac.uk) that seems to offer the code
>(written by Magnus Hagdorn) is not responding. I don't know if that's a
>temporary condition or if that site is out of commission.
>
>Google isn't revealing much re
i have a 2000 files with header and data
i need to get the date information from the header
then insert it into my database
i am doing it in batch so i use glob.glob('/mydata/*/*/*.txt')
to get the date on line 4 in the txt file i use
linecache.getline('/mydata/myfile.txt/, 4)
but if i use
linecac
i want to share my secrets with u.
how to create miracles in your own life?
http://www.freewebs.com/aquorang/
http://indianfriendfinder.com/go/g926592-pmem
http://bigchurch.com/go/g926592-pmem
--
http://mail.python.org/mailman/listinfo/python-list
Well, I don't know much python, yet, but I know a csv file when I see
one...and an Excel files in not a csv file.
As far as I know, an Excel file is stored probably in binary and in a
propriatery format...I doubt very much csv.reader would read that just
like that; then again, I know nothing about
Hi,
I am trying to read a csv file using csv.reader. The file is created
using Open Office and saved in Excel format.
import csv
reader = csv.reader(open('test.xls'))
for row in reader:
print row
It however throws the exception _csv.Error:
: line contains NULL byte
Any idea whats going wro
On Jan 3, 8:49 pm, grbgooglefan <[EMAIL PROTECTED]> wrote:
> On Jan 3, 8:02 pm, Phil Thompson <[EMAIL PROTECTED]>
> wrote:
>
>
>
>
>
> > On Thursday 03 January 2008, grbgooglefan wrote:
>
> > > I have a following C++ code which uses PyObject_CallObject to evaluate
> > > expressions dynamically. Thi
Hi there same project I am afraid...
I want to put the text from the selection of a listbox into a Label when the
the selection is clicked.
I have it so it is put in, but it is put in when I click on the
*next*selection...as in it defines the variable when I click on the
desired the
selection, bu
Hello,
Welcome to Python!
glob returns a list of filenames, but getline is made to work on just
one filename.
So you'll need to iterate over the list returned by glob.
>>> import linecache, glob
>>> for filename in glob.glob('/etc/*'):
>>> print linecache.getline(filename, 4)
Maybe you coul
On Thu, 2008-01-03 at 17:25 -0800, t_rectenwald wrote:
> On Jan 3, 7:47 pm, t_rectenwald <[EMAIL PROTECTED]> wrote:
> > I have a python script that uses the cx_Oracle module. I have a list
> > of values that I iterate through via a for loop and then insert into
> > the database. This works okay,
Hello - I'm seeking info on the PyGMT python wrapper for the Generic Mapping
Tools package.
Unfortunately, the only site (forge.nesc.ac.uk) that seems to offer the code
(written by Magnus Hagdorn) is not responding. I don't know if that's a
temporary condition or if that site is out of commission.
hi everyone happy new year!
im a newbie to python
i have a question
by using linecache and glob
how do i read a specific line from a file in a batch and then insert
it into database?
because it doesn't work! i can't use glob wildcard with linecache
>>> import linecache
>>> linecache.getline(glob.
On Thu, 03 Jan 2008 11:38:48 -0300, Bruno Ferreira wrote:
> Hi,
>
> I wrote a very simple python program to generate a sorted list of lines
> from a squid access log file.
>
> Here is a simplified version:
>
> ##
> 1 logfile = open ("squid_access.log", "r")
> 2
On Thu, 03 Jan 2008 16:56:00 -0600, Reedick, Andrew wrote:
> The problem occurred because a method used to generate keys was
> returning a string instead of a number without an explicit conversion
> taking place. And since I was using hash.get(i, default_value) to avoid
> having to pair every key
visitame www.lucasares.com.ar
--
http://mail.python.org/mailman/listinfo/python-list
Hi,
I am running a python script that will change the attribute of a directory and
its subdiretory by command:
os.system("chmod -R .")
or
os.system("attrib -R * /S")
Both commands chmod and attrib run quite fast in dos command shell. However,
inside python, they are very slow and
On Jan 3, 7:47 pm, t_rectenwald <[EMAIL PROTECTED]> wrote:
> I have a python script that uses the cx_Oracle module. I have a list
> of values that I iterate through via a for loop and then insert into
> the database. This works okay, but I'm not sure whether I can use one
> cursor for all inserts
> > (Is this the right place to ask ctypes questions? There's a mailing list
> > but the last post to it seems to have been in November 2006.)
>
> No, it's active.
Thanks. I guess the official ASPN-based archive must be dead.
I managed to sort of get access to the array just using indexing
as
I have a python script that uses the cx_Oracle module. I have a list
of values that I iterate through via a for loop and then insert into
the database. This works okay, but I'm not sure whether I can use one
cursor for all inserts, and define it outside of the loop, or
instantiate and close the c
> As a Perl monkey in the process of learning Python, I just stepped on
> the "'1' (string) is not the same as 1 (integer) in regards to keys for
> dictionaries/hashes" landmine. Is there a good way to ensure that
> numbers represented as strings or ints do not get mixed up as keys?
>
Well one im
SMALLp wrote:
> I'm using py2exe to port my applications on windows so user won't have
> to install python and other dependencies. Everything works file except
> when i run any of programs it star's command prompt before program starts.
>
> How can i avoid this to happen
use windows= instead of
HY!
I'm using py2exe to port my applications on windows so user won't have
to install python and other dependencies. Everything works file except
when i run any of programs it star's command prompt before program starts.
How can i avoid this to happen, and is there any other way of porting my
[EMAIL PROTECTED] schrieb:
> (Is this the right place to ask ctypes questions? There's a mailing list
> but the last post to it seems to have been in November 2006.)
No, it's active.
> Using ctypes I reference a structure which contains a pointer to an array of
> another structure:
>
> clas
On Jan 4, 9:56 am, "Reedick, Andrew" <[EMAIL PROTECTED]> wrote:
> As a Perl monkey in the process of learning Python, I just stepped on
> the "'1' (string) is not the same as 1 (integer) in regards to keys for
> dictionaries/hashes" landmine.
Congratulations. You have just stepped off the "'1' (st
(Is this the right place to ask ctypes questions? There's a mailing list
but the last post to it seems to have been in November 2006.)
Using ctypes I reference a structure which contains a pointer to an array of
another structure:
class SYMBOL(Structure):
_fields_ = [("symbol", c_ch
On Jan 4, 8:03 am, mario <[EMAIL PROTECTED]> wrote:
> On Jan 2, 2:25 pm, Piet van Oostrum <[EMAIL PROTECTED]> wrote:
>
> > Apparently for the empty string the encoding is irrelevant as it will not
> > be used. I guess there is an early check for this special case in the code.
>
> In the module I an
As a Perl monkey in the process of learning Python, I just stepped on
the "'1' (string) is not the same as 1 (integer) in regards to keys for
dictionaries/hashes" landmine. Is there a good way to ensure that
numbers represented as strings or ints do not get mixed up as keys?
Example of the proble
On Jan 3, 1:55 am, Stefan Behnel <[EMAIL PROTECTED]> wrote:
> paul wrote:
> >> Can i create python classes based off the XSD files? What else can I
> >> do with the XSD files?
> > This might be worth looking at:http://www.rexx.com/~dkuhlman/#generateDS
>
> If it's really such a complex XML language
Emin.shopper Martinian.shopper wrote:
> Is there a good way to choose/assign random dynamic port numbers in python?
>
> I had in mind something like the following, but if multiple programs are
> generating random port numbers, is there a way to check if a given port
> number is already taken?
>
Dear Experts,
Is there a good way to choose/assign random dynamic port numbers in python?
I had in mind something like the following, but if multiple programs are
generating random port numbers, is there a way to check if a given port
number is already taken?
def GenerateDynamicPortNumber():
> Further experimentation showed that derivation from object was the
> culprit; new-style objects are not considered "instances" in the above
> sense. I wasn't able to figure out a workaround. Is there one, or is
> the distinction between traditional classes and built-in types only
> going to get
On Jan 3, 6:49 pm, "Martin Marcher" <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I know it's not a trivial field but I had some readings about
> artificial intelligence lately and my personal conclusion is that it's
> mostly just statistics.
>
> Naively explained:
>
> continiously gather and store informat
On Jan 3, 11:49 am, "Martin Marcher" <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I know it's not a trivial field but I had some readings about
> artificial intelligence lately and my personal conclusion is that it's
> mostly just statistics.
>
> Naively explained:
>
> continiously gather and store informa
On Jan 3, 9:15 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> I have a class that derives from Exception. In Python 2.4,
> isinstance(MyClass(), types.InstanceType) was True. In 2.5, it's
> False.
>
> Further experimentation showed that derivation from object was the
> culprit; new-style ob
[EMAIL PROTECTED] wrote:
> Further experimentation showed that derivation from object was the
> culprit; new-style objects are not considered "instances" in the above
> sense. I wasn't able to figure out a workaround. Is there one, or is
> the distinction between traditional classes and built-in
I have a class that derives from Exception. In Python 2.4,
isinstance(MyClass(), types.InstanceType) was True. In 2.5, it's
False.
Further experimentation showed that derivation from object was the
culprit; new-style objects are not considered "instances" in the above
sense. I wasn't able to fi
On Jan 2, 2:25 pm, Piet van Oostrum <[EMAIL PROTECTED]> wrote:
> Apparently for the empty string the encoding is irrelevant as it will not
> be used. I guess there is an early check for this special case in the code.
In the module I an working on [*] I am remembering a failed encoding
to allow me
Thanks, will do...
On Jan 3, 2:07 pm, [EMAIL PROTECTED] wrote:
> On Jan 3, 11:50 am, Adeola Bannis <[EMAIL PROTECTED]> wrote:
>
>
>
> > Hi everyone,
>
> > I'm doing a project using wxPython and pyopengl, and I seem to have a
> > problem rendering textures. This is code that worked before my hard
>
On Jan 3, 8:48 am, Nicola Musatti <[EMAIL PROTECTED]> wrote:
> Hallo,
> First of all I apologize for the longish example at the bottom, but
> the biggest source file is automatically generated and I didn't want
> to modify more than strictly necessary. Also, it would be shorter if
> XML wasn't so v
Dimitrios Apostolou <[EMAIL PROTECTED]> writes:
> On Wed, 2 Jan 2008, Rob Wolfe wrote:
>
>> Dimitrios Apostolou <[EMAIL PROTECTED]> writes:
>>
>>> Hello list,
>>>
>>> I've been looking for a way to explicitly disable the use of proxies with
>>> urllib2, no matter what the environment dictates. Unf
On Jan 3, 11:50 am, Adeola Bannis <[EMAIL PROTECTED]> wrote:
> Hi everyone,
>
> I'm doing a project using wxPython and pyopengl, and I seem to have a
> problem rendering textures. This is code that worked before my hard
> drive had a meltdown, but not since I re-installed everything.
>
> I've deter
On Jan 3, 2008 8:05 AM, Tim Chase <[EMAIL PROTECTED]> wrote:
> >> But you can't alter the values for True/False globally with this.
> >
> > Are you sure ? what about the following example ?
> > Is this also shadowing ?
> >
> import __builtin__
> __builtin__.True = False
> __builtin__
On Jan 3, 4:39 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> On Dec 29 2007, 11:10 pm, Raymond Hettinger <[EMAIL PROTECTED]> wrote:
>
> > I'm considering deprecating these two functions and would like some
> > feedback from the community or from people who have a background in
> > functional
On Jan 3, 7:04 am, Bernhard Merkle <[EMAIL PROTECTED]>
wrote:
> Hi there,
>
> I am reading Learning Python 3e from Mark Lutz and just found out that
> reassigning to builtins is possible.
> What is the reason, why Python allows this ? IMO this is very risky
> and can lead to hard to find errors.
I
Diez B. Roggisch wrote:
>> I would think it more likely that he wants to end up with u'Bob\u2019s
>> Breakfast' rather than u'Bob\x92s Breakfast' although u'Dog\u2019s dinner'
>> seems a probable consequence.
>
> If that's the case, he should read the file as string, de- and encode it
> (proba
urllib has a "hole" in its timeout protection.
Using "socket.setdefaulttimeout" will make urllib time out if a
site doesn't open a TCP connection in the indicated time. But if the site
opens the TCP connection and never sends HTTP headers, it takes about
20 minutes for the read in urllib's
Duncan Booth schrieb:
> Fredrik Lundh <[EMAIL PROTECTED]> wrote:
>
>> ET has already decoded the CP1252 data for you. If you want UTF-8, all
>> you need to do is to encode it:
>>
> u'Bob\x92s Breakfast'.encode('utf8')
>> 'Bob\xc2\x92s Breakfast'
>>
> I think he is claiming that the encoding
Hi everyone,
I'm doing a project using wxPython and pyopengl, and I seem to have a
problem rendering textures. This is code that worked before my hard
drive had a meltdown, but not since I re-installed everything.
I've determined the problem is in the OpenGL part of my program. I do
some calculat
On Jan 3, 3:41 pm, [EMAIL PROTECTED] wrote:
> Yes in the sense that the top part will have merged cells so that
> Horror and Classics don't need to be repeated every time, but the
> headers aren't the important part. At this point I'm more interested
> in organizing the data itself and i can worry
Hi,
I know it's not a trivial field but I had some readings about
artificial intelligence lately and my personal conclusion is that it's
mostly just statistics.
Naively explained:
continiously gather and store information and apply a default rating
1) answer "questions" with gathered informatio
Hopefully this isn't too OT.
One thing I like about comp.lang.python is the breadth of topics
discussed here. People can ask about Python installation and
configuration issues on specific platforms, compare third party
libraries, ask for book recommendations, and discuss current Python
projects.
On 03 Jan 2008 16:09:53 GMT, <[EMAIL PROTECTED]> wrote:
>
> [EMAIL PROTECTED] wrote:
> > hi, i have some code where i set a bool type variable and if the value
> > is false i would like to return from the method with an error msg..
> > being a beginner I wd like some help here
> >
> > class myclas
Nicola Musatti wrote in news:92dfc2fc-0677-43c0-b34f-4f240fa40205
@e4g2000hsg.googlegroups.com in comp.lang.python:
Note there is a wxpython mailinglist/newsgroup:
news:gmane.comp.python.wxpython
[snip]
> problem lies in the fact that apparently ShowModal() does not return
> when either
Hi,
Could anybody tell me which is the easier way to do a SOAP call to a web
service wich requires an http header to be present?
I can't figure it out.
Thanks a lot
Some code I'm using:
import SOAPpy
s =
SOAPpy.SOAPProxy("http://10.3.5.128:10560/SERVICES",namespace="http://ws.mysite.com";)
On Dec 29 2007, 11:10 pm, Raymond Hettinger <[EMAIL PROTECTED]> wrote:
> I'm considering deprecating these two functions and would like some
> feedback from the community or from people who have a background in
> functional programming.
Well I have just this minute used dropwhile in anger, to find
On Jan 3, 2008 11:24 AM, Emin.shopper Martinian.shopper <
[EMAIL PROTECTED]> wrote:
> How do you pass the -c option to setup.py install?
After some fiddling, I figured out that you can put the following two lines
in setup.cfg:
[build]
compiler=mingw32
It would be nice if you could somehow pass
Emin.shopper Martinian.shopper wrote:
> Dear Experts,
>
> How do you pass the -c option to setup.py install? Specifically, when I try
> to install zope.interfaces version 3.3 from source on a windows machine, I
> get a message about using "-c mingw32". That works fine for setup.py build,
> but it
Dear Experts,
How do you pass the -c option to setup.py install? Specifically, when I try
to install zope.interfaces version 3.3 from source on a windows machine, I
get a message about using "-c mingw32". That works fine for setup.py build,
but it does not work for "setup.py install".
Note: I wou
[EMAIL PROTECTED] wrote:
> hi, i have some code where i set a bool type variable and if the value
> is false i would like to return from the method with an error msg..
> being a beginner I wd like some help here
>
> class myclass:
> .
> def mymethod(self):
> success=
Fredrik Lundh <[EMAIL PROTECTED]> wrote:
> ET has already decoded the CP1252 data for you. If you want UTF-8, all
> you need to do is to encode it:
>
> >>> u'Bob\x92s Breakfast'.encode('utf8')
> 'Bob\xc2\x92s Breakfast'
>
I think he is claiming that the encoding information in the file is
inc
On Jan 2, 2:01 pm, [EMAIL PROTECTED] wrote:
> Hello,
>
> Does anyone have experience using cx_Oracle to call a stored procedure
> that inserts to a clob field? We have done this successfully via
> straight SQL, but we are at a loss on how to do the same insert using
> a stored procedure call. Any
[EMAIL PROTECTED] wrote:
> hi, i have some code where i set a bool type variable and if the value
> is false i would like to return from the method with an error msg..
> being a beginner I wd like some help here
>
> class myclass:
> .
> def mymethod(self):
> success
hi, i have some code where i set a bool type variable and if the value
is false i would like to return from the method with an error msg..
being a beginner I wd like some help here
class myclass:
.
def mymethod(self):
success=True
msg="all validation OK"
On Wed, 2 Jan 2008, Rob Wolfe wrote:
> Dimitrios Apostolou <[EMAIL PROTECTED]> writes:
>
>> Hello list,
>>
>> I've been looking for a way to explicitly disable the use of proxies with
>> urllib2, no matter what the environment dictates. Unfortunately I can't find
>> a way in the documentation, a
Simon Willison wrote:
> But ElementTree gives me back a unicode string, so I get the following
> error:
>
print u'Bob\x92s Breakfast'.decode('cp1252').encode('utf8')
> Traceback (most recent call last):
> File "", line 1, in
> File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
Bruno Ferreira wrote:
> When I execute the program _without_ the lines 10 and 11:
>
> 10 if len(topsquid) > 50:
> 11 topsquid = topsquid[0:50]
>
> it runs perfectly.
>
> But if I execute the program _with_ those lines, this exception is thrown:
>
> [EMAIL PROTECTED]:~$ python topsq
Tim Roberts schrieb:
> Joachim Durchholz <[EMAIL PROTECTED]> wrote:
>
>>> Xah Lee <[EMAIL PROTECTED]> wrote:
[...] PHP and Perl are practically identical in their
high-levelness or expressiveness or field of application (and
syntax),
>> That must have been a very, very distant point
Bruno Ferreira wrote:
> Hi,
>
> I wrote a very simple python program to generate a sorted list of
> lines from a squid access log file.
>
> Here is a simplified version:
>
> ##
> 1 logfile = open ("squid_access.log", "r")
> 2 topsquid = [["0", "0", "0", "0", "0
On Jan 2, 9:34 pm, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote:
> > In any case, it goes well beyond the situation that triggered my
> > original question in the first place, that basically was to provide a
> > reasonable check on whether round-tripping a string is successful --
> > this is in the
Hallo,
First of all I apologize for the longish example at the bottom, but
the biggest source file is automatically generated and I didn't want
to modify more than strictly necessary. Also, it would be shorter if
XML wasn't so verbose ;-)
The following is a wxPython/XRC toy program with a form wit
Bruno Ferreira wrote:
> Hi,
>
> I wrote a very simple python program to generate a sorted list of
> lines from a squid access log file.
>
> Here is a simplified version:
>
> ##
> 1 logfile = open ("squid_access.log", "r")
> 2 topsquid = [["0", "0", "0", "0", "0"
Bruno Ferreira wrote:
> Hi,
>
> I wrote a very simple python program to generate a sorted list of
> lines from a squid access log file.
>
> Here is a simplified version:
>
> ##
> 1 logfile = open ("squid_access.log", "r")
> 2 topsquid = [["0", "0", "0", "0", "0"
Yes in the sense that the top part will have merged cells so that
Horror and Classics don't need to be repeated every time, but the
headers aren't the important part. At this point I'm more interested
in organizing the data itself and i can worry about putting it into a
new excel file later.
--
h
Hi,
I wrote a very simple python program to generate a sorted list of
lines from a squid access log file.
Here is a simplified version:
##
1 logfile = open ("squid_access.log", "r")
2 topsquid = [["0", "0", "0", "0", "0", "0", "0"]]
3
4 def add_sorted (list):
5
Thanks again. I will chunk my responses as your message has too much
in it for me to process all at once...
On Jan 2, 9:34 pm, "Martin v. Löwis" <[EMAIL PROTECTED]> wrote:
> > Thanks a lot Martin and Marc for the really great explanations! I was
> > wondering if it would be reasonable to imagine a
Stefan Behnel wrote:
>> also, putting large documents in a *single* Python string can be quite
>> inefficient. it's often more efficient to use lists of string fragments.
>
> That's a pretty general statement. Do you mean in terms of reading from that
> string (which at least in lxml is a straig
Hi all,
I have written a script to parse a CSV file:
import csv
def get_lines(fname):
fhandle = csv.reader(open(fname,"rb"))
for line in fhandle:
while fhandle.next()[0] == "prot_hit_num":
continue
for row in fhandle:
print row
result = get
>> But you can't alter the values for True/False globally with this.
>
> Are you sure ? what about the following example ?
> Is this also shadowing ?
>
import __builtin__
__builtin__.True = False
__builtin__.True
> False
It doesn't seem to screw things up globally
>>> import __b
-On [20080103 14:47], Bernhard Merkle ([EMAIL PROTECTED]) wrote:
>Are you sure ? what about the following example ?
>Is this also shadowing ?
It is, as it is local to your current executing interpreter. Any other Python
process that is currently running is unaffected by your shadowing. So a
-On [20080103 14:36], Simon Willison ([EMAIL PROTECTED]) wrote:
>How can I tell Python "I know this says it's a unicode string, but I
>need you to treat it like a bytestring"?
Although it does not address the exact question it does raise the issue how
you are using Elemen
Simon Willison wrote:
> Hello,
>
> I'm using ElementTree to parse an XML file which includes some data
> encoded as cp1252, for example:
>
> Bob\x92s Breakfast
>
> If this was a regular bytestring, I would convert it to utf8 using the
> following:
>
print 'Bob\x92s Breakfast'.decode('cp12
Bernhard Merkle wrote:
> On Jan 3, 2:07 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote:
>> This hal always been possible. But it's not reassigning, it's shadowing -
>> which is a totally different beast. Shadowing builtins is bad style, but
>> lokal to your context. Which can get nasty of course
Fredrik Lundh wrote:
> Stefan Behnel wrote:
>
>>> My take on the API decision in question was always that a file is
>>> inherently an XML *document*, while a string is inherently an XML
>>> *fragment*.
>>
>> Not inherently, no. I know some people who do web processing with an XML
>> document comin
Hello Group,
I have compile the python source code using MSVC 8 (a.k.a VS .NET
2005) .
Can i create an MSI ?? similar to one provided by the official python
website.
What can be the possible procedure to achieve this.
I have looked into Tools/msi folder. But i dont know how it works.
Thank you
Simon Willison <[EMAIL PROTECTED]> wrote:
> How can I tell Python "I know this says it's a unicode string, but I
> need you to treat it like a bytestring"?
Can you not just fix your xml file so that it uses the same encoding as it
claims to use? If the xml says it contains utf8 encoded data then
On Jan 3, 2:07 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote:
> This hal always been possible. But it's not reassigning, it's shadowing -
> which is a totally different beast. Shadowing builtins is bad style, but
> lokal to your context. Which can get nasty of course, if you do the above
> on e.
On Jan 3, 1:31 pm, Simon Willison <[EMAIL PROTECTED]> wrote:
> How can I tell Python "I know this says it's a unicode string, but I
> need you to treat it like a bytestring"?
u'Bob\x92s Breakfast'.encode('latin-1')
--
Paul Hankin
--
http://mail.python.org/mailman/listinfo/python-list
Hello,
I'm using ElementTree to parse an XML file which includes some data
encoded as cp1252, for example:
Bob\x92s Breakfast
If this was a regular bytestring, I would convert it to utf8 using the
following:
>>> print 'Bob\x92s Breakfast'.decode('cp1252').encode('utf8')
Bob's Breakfast
But Ele
Bernhard Merkle wrote:
> Hi there,
>
> I am reading Learning Python 3e from Mark Lutz and just found out that
> reassigning to builtins is possible.
> What is the reason, why Python allows this ? IMO this is very risky
> and can lead to hard to find errors.
> (see also Learning Python 3e, Chapter
ashish wrote:
> Hi All,
>
> I am trying to install "pylibpcap-0.6.1" but i am getting these errors .
>
>
> python ./setup.py install
>
> .
> .
> .
> .
> .
>
> constants.c:172: (near initialization for `pcapmodule_DLT[52]')
> pcap.c: In function `init_pcap':
> pcap.c:4246: structure has no mem
Hi there,
I am reading Learning Python 3e from Mark Lutz and just found out that
reassigning to builtins is possible.
What is the reason, why Python allows this ? IMO this is very risky
and can lead to hard to find errors.
(see also Learning Python 3e, Chapter 16, Page 315)
>>> True
True
>>> Fals
>
> You might be interested in workingenv.py/virtualenv.py
>
Thanks! That looks promising.
-T
--
http://mail.python.org/mailman/listinfo/python-list
Hi All,
I am trying to install "pylibpcap-0.6.1" but i am getting these errors .
python ./setup.py install
.
.
.
.
.
constants.c:172: (near initialization for `pcapmodule_DLT[52]')
pcap.c: In function `init_pcap':
pcap.c:4246: structure has no member named `value'
pcap.c:4260: warning: passing
On Jan 3, 8:02 pm, Phil Thompson <[EMAIL PROTECTED]>
wrote:
> On Thursday 03 January 2008, grbgooglefan wrote:
>
> > I have a following C++ code which uses PyObject_CallObject to evaluate
> > expressions dynamically. This code sets the input parameters for the
> > function also dynamically. After c
Stefan Behnel wrote:
>> My take on the API decision in question was always that a file is
>> inherently an XML *document*, while a string is inherently an XML
>> *fragment*.
>
> Not inherently, no. I know some people who do web processing with an XML
> document coming in as a string (from an HTTP
On Thursday 03 January 2008, grbgooglefan wrote:
> I have a following C++ code which uses PyObject_CallObject to evaluate
> expressions dynamically. This code sets the input parameters for the
> function also dynamically. After calling this function 4 times (with
> these shown values), PyObject_Cal
grbgooglefan wrote:
> I have a following C++ code which uses PyObject_CallObject to evaluate
> expressions dynamically. This code sets the input parameters for the
> function also dynamically. After calling this function 4 times (with
> these shown values), PyObject_CallObject causes application
I have a following C++ code which uses PyObject_CallObject to evaluate
expressions dynamically. This code sets the input parameters for the
function also dynamically. After calling this function 4 times (with
these shown values), PyObject_CallObject causes application to crash
in frame_dealloc.
1)
1 - 100 of 108 matches
Mail list logo