Daniel Fetchinson wrote:
> After getting the technicalities out of the way, maybe I should have
> asked:
>
> Is it only me or others would find a platform independent python API
> to clear the terminal useful?
There are two kinds of programs:
1. Those that process input to output. If one of those
aimeixu wrote:
> I really need help to figure out a way to get someone's calendar from
> mail exchange server with python.
You can implement any network protocol with Python, see e.g. the struct
library. However, it would be easier to use an existing protocol
implementation. When you say "mail exc
superpollo wrote:
> ... s += i**2
> ... if not (i+1)%5:
> ... s -= 2*i**2
> ... if not i%5:
> ... s -= 2*i**2
if not (i % 5) in [1, 2]:
s += i**2
else:
s -= i**2
Untested code.
Uli
--
Sator Laser GmbH
Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR
superpollo wrote:
> mine goes like this:
>
> >>> bin(192)
> Traceback (most recent call last):
>File "", line 1, in
> NameError: name 'bin' is not defined
Yep, one of mine, too. The "bin" function was new in 2.6, as were binary
number literals ("0b1100").
Uli
--
Sator Laser GmbH
Geschäft
Peter Otten wrote:
> Ulrich Eckhardt wrote:
>> Says Python:
>>
>>>>> bin(192)
>> '0x1100'
>
> Hmm, if that's what /your/ Python says, here's mine to counter:
>
>>>> bin(192)
> '0_totally_faked_binary_0
Nobody wrote:
> On Mon, 07 Jun 2010 02:31:08 -0700, Richard Thomas wrote:
>
>> You're reading those bits backwards. You want to read the most
>> significant bit of each byte first...
>
> Says who?
Says Python:
>>> bin(192)
'0x1100'
That said, I totally agree that there is no inherently rig
Ulrich Eckhardt wrote:
>data = f.read()
>for byte in data:
>for i in range(8):
>bit = 2**i & byte
>...
Correction: Of course you have to use ord() to get from the single-element
string ("byte" above) to its integral value firs
Alfred Bovin wrote:
> I'm working on something where I need to read a (binary) file bit by bit
> and do something depending on whether the bit is 0 or 1.
Well, smallest unit you can read is an octet/byte. You then check the
individual digits of the byte using binary masks.
f = open(...)
da
Hi!
I have a class that maintains a network connection, which can be used to
query and trigger Things(tm). Apart from "normal" errors, a broken network
connection and a protocol violation from the peer are something we can't
recover from without creating a new connection, so those errors
should "s
Hi!
When I use help() on a function, it displays the arguments of the function,
along with the docstring. However, when wrapping the function using
functools.wraps it only displays the arguments that the (internal) wrapper
function takes, which is typically "*args, **kwargs", which isn't very
usef
Vincent Davis wrote:
> I am looking for the most efficient (speed) way to produce an an
> iterator to of permutations.
> One of the problem I am having it that neither combinations nor
> permutations does not exactly what I want directly.
> For example If I want all possible ordered lists of 0,1 of
Hi!
I wrote a simple loop like this:
d = {}
...
for k in d:
if some_condition(d[k]):
d.pop(k)
If I run this, Python complains that the dictionary size changed during
iteration. I understand that the iterator relies on the internal structure
not changing, but how would I str
Richard Lamboj wrote:
> "How knows python that it is a float, or a string?" Sorry this was bad
> expressed. I want to create a new data type, which inherits from float. I
> just know the "dir" function and the "help" function to get more
> infromations about the class, but i need to get more inform
Richard Lamboj wrote:
> i want to inherit from a data type. How can i do this? Can anyone explain
> more abou this?
Other than in e.g. C++ where int and float are special types, you can
inherit from them in Python like from any other type. The only speciality
of int, float and string is that they
Ulrich Eckhardt wrote:
> I have a list [1,2,3,4,5,6] which I'd like to iterate as (1,2), (3,4),
> (5,6). I can of course roll my own, but I was wondering if there was
> already some existing library function that already does this.
>
>
> def as_pairs(seq):
> i = ite
Hi!
I have a list [1,2,3,4,5,6] which I'd like to iterate as (1,2), (3,4),
(5,6). I can of course roll my own, but I was wondering if there was
already some existing library function that already does this.
def as_pairs(seq):
i = iter(seq)
yield (i.next(), i.next())
Question to this cod
Nico Schlömer wrote:
> So when I go like
>
> for item in list:
> item[1].sort()
>
> I actually modify *list*? I didn't realize that; I thought it'd just
> be a copy of it.
No, I misunderstood your code there. Modifying the objects inside the list
is fine, but I don't thing you do that, provi
Nico Schlömer wrote:
> I ran into a bit of an unexpected issue here with itertools, and I
> need to say that I discovered itertools only recently, so maybe my way
> of approaching the problem is "not what I want to do".
>
> Anyway, the problem is the following:
> I have a list of dictionaries, som
Jimbo wrote:
> Can you help me figure out why I am getting this compile error with my
> program. The error occurs right at the bottom of my code & I have
> commented where it occurs.
[...]
> def main():
> programEnd = False;
>
> while (programEnd == False):
> #ERROR HERE?? - Error=
Chris Rebert wrote:
> You're a bit behind the times.
> If my calculations are right, that comic is over 2 years old.
import timetravel
Uli
--
http://mail.python.org/mailman/listinfo/python-list
Alex Hall wrote:
> On 3/15/10, Ulrich Eckhardt wrote:
>> Alex Hall wrote:
>>> I have a dll I am trying to use, but I get a Windows error 126, "the
>>> specified module could not be found". Here is the code segment:
>>> nvdaController=ctypes.
Alex Hall wrote:
> I have a dll I am trying to use, but I get a Windows error 126, "the
> specified module could not be found". Here is the code segment:
> nvdaController=ctypes.windll.LoadLibrary("nvdaControllerClient32.dll")
In addition to Alf's answer, this can also happen when the OS can't fin
Alex Hall wrote:
> Now, though, when I press ctrl-shift-c (keystroke 11), nothing
> happens.
Control-C sends a special signal to the console, like Control-Break.
> Pressing any other keystroke after that will crash the program
> with some sort of Python internal com server exception that I
> have
asit wrote:
> pattern = raw_input("Enter the file pattern to search for :\n")
> commandString = "find " + pattern
> commandOutput = commands.getoutput(commandString)
> findResults = string.split(commandOutput, "\n")
> print "Files : "
> print commandOutput
> print "=
Peter Otten wrote:
> Duncan Booth wrote:
>> for rq in incoming_requests(...):
>>handle_request(rq)
>
> ...and a likely implementation would be
>
> def incoming_requests(...):
> while True:
> rq = ... # inlined version of get_request()
> if not rq:
> break
>
Hi!
I'm looking for a way to write code similar to this C code:
while(rq = get_request(..)) {
handle_request(rq);
}
Currently I'm doing
while True:
rq = get_request(...)
if not rq:
break
handle_request(rq)
in Python 2.6. Any suggestions how to rewrite tha
Just for the record: Neither of the below methods actually produce a
multiline string. They only spread a string containing one line over
multiple lines of source code.
lallous wrote:
> Maybe that's already documented, but it seems the parser accepts to
> build a long string w/o really using the f
Jens Müller wrote:
> I try to decode a string,e.g.
> u'M\xfcnchen, pronounced [\u02c8m\u028fn\xe7\u0259n]'.decode('cp1252',
> 'ignore')
> but even thoug I use errors='ignore'
> I get UnicodeEncodeError: 'charmap' codec can't encode character u'\u02c8'
> in position 21: character maps to
>
> How c
vsoler wrote:
> class stepper:
> def __getitem__(self, i):
> return self.data[i]
>
> X=stepper()
> X.data="Spam"
> for item in X:
> print item,
>
> ... what I get is S p a m which seems logical to me since the
> loop stops after the 4th character.
I think you're mistaking
Peng Yu wrote:
> Could somebody let me know how the python calls and exceptions are
> dispatched? Is there a reference for it?
I'm not a Python expert, but I have read some parts of the implementation.
Hopefully someone steps up if I misrepresent things here...
In order to understand Python exce
dpapathanasiou wrote:
> I have two methods for writing binaries files: the first works with
> data received by a server corresponding to a file upload, and the
> second works with data sent as email attachments.
Hmmm, no. Looking at your code, the first of your functions actually treats
its argume
Lie Ryan wrote:
> On 12/4/2009 8:28 AM, Ulrich Eckhardt wrote:
>> I'm trying to write some code to diff two fonts. What I have is every
>> character (glyph) of the two fonts in a list. I know that the list is
>> sorted by the codepoints of the characters. What I'd
Hi!
I'm trying to write some code to diff two fonts. What I have is every
character (glyph) of the two fonts in a list. I know that the list is sorted
by the codepoints of the characters. What I'd like to ask is whether there
is a more elegant solution to the loop below or whether there are any
eric.frederich wrote:
> Is there a way to set up environment variables in python itself
> without having a wrapper script.
Yes, sure, you can set environment variables...
> The wrapper script is now something like
>
> #!/bin/bash
>
> export LD_LIBRARY_PATH="/some/thing/lib:$LD_LIBRARY_PATH"
Hia!
I need to read a file containing packed "binary" data. For that, I find the
struct module pretty convenient. What I always need to do is reading a chunk
of data from the file (either using calcsize() or a struct.Struct instance)
and then parsing it with unpack(). For that, I repeatedly wri
Diez B. Roggisch wrote:
> kj schrieb:
>> lol = [[] for _ in xrange(500)]
>
> If you call that hideous, I suggest you perform the same exercise in
> Java or C++ - and then come back to python and relax
I might be missing something that's not explicitly mentioned here, but I'd
say that all n
Ethan Furman wrote:
> Python 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit
> (Intel)] on win32
> Type "help", "copyright", "credits" or "license" for more information.
> >>> print u'\xed'
> í
> >>> print u'\xed'.encode('cp437')
> í
> >>> print u'\xed'.encode('cp850')
> í
> >>> pr
Santiago Romero wrote:
> Well, In the above concrete example, that would work, but I was
> talking for multiple code lines, like:
>
>
> #define LD_r_n(reg) (reg) = Z80ReadMem(r_PC++)
>
> #define LD_rr_nn(reg) r_opl = Z80ReadMem(r_PC); r_PC++; \
> r_oph = Z80ReadMem(r_PC
Aaron Watters wrote:
> In the last couple months on a few occasions
> I've tried various Python libraries (and I'm not going to
> name names) and run into some problem.
>
> Following the documented procedure [...]
Documented where?
> [...] I eventually post the problem to the "support" list
Whi
Tommy Grav wrote:
> I have created a binary file that saves this struct from some C code:
>
>struct recOneData {
> char label[3][84];
> char constName[400][6];
> double timeData[3];
> long int numConst;
> double AU;
> double EMRAT;
> long
arve.knud...@gmail.com wrote:
> On Oct 19, 3:48 pm, Ethan Furman wrote:
>> arve.knud...@gmail.com wrote:
[...]
>>> def create():
>>> f = file("tmp", "w")
>>> raise Exception
>>>
>>> try:
>>> create()
>>> finally:
>>> os.remove("tmp")
>>>
[...]
>> When an exception is raised, the e
Ole Streicher wrote:
> I am curious when one should implement a "__call__()" and when a
> "__getitem__()" method.
>
> For example, I want to display functions and data in the same plot.
Wait: The term 'function' is overloaded. In Python and programming in
general, a function is a piece of code wi
Gabriel Genellina wrote:
>> #ifdef _DEBUG
>> #undef _DEBUG
>> #include
>> #define _DEBUG
>> #else
>> #include
>> #endif
[...to keep Python from linking against non-existant debug libraries.]
>
> No, don't do that. Just compile your application in release mode.
Why not, does it break anything?
Christopher Lloyd wrote:
> I'm a relatively inexperienced programmer, and have been learning some
> basic C++ and working through the demos in Ron Penton's "MUD Game
> Programming" book. In it, Python modules are run from inside a C++
> program.
[...]
> If I try to compile this in MS Visual C++ 200
Irmen de Jong wrote:
> [...] is there any reason why you would go the route of embedding python
> in C++ ? Why not just stick to (pure) Python? Embedding C or C++ stuff
> as extension modules in Python (if you really need to do this) is easier
> than the other way around, in my experience.
If you
Laszlo Nagy wrote:
> Ulrich Eckhardt írta:
>> Hi!
>>
>> I'm looking at the 'threading' module and see that other than the
>> 'thread' module it doesn't have a simple function to start a new thread.
>> Instead, you first have to instan
sturlamolden wrote:
> On 8 Okt, 09:17, Ulrich Eckhardt wrote:
>
>> I'm looking at the 'threading' module and see that other than the
>> 'thread' module it doesn't have a simple function to start a new thread.
>> Instead, you first have to in
Hi!
I'm looking at the 'threading' module and see that other than the 'thread'
module it doesn't have a simple function to start a new thread. Instead,
you first have to instantiate a threading object and then start the new
thread on it:
t = threading.Thread(target=my_function)
t.start()
Wha
Dan Stromberg wrote:
> My new version formats an SD card and preallocates some file space in
> about 3 minutes with "Optimize Performance" selected, and in about 30
> minutes with "Optimize for Quick Removal" selected. Needless to say, I
> don't like the 27 minute penalty much.
For performance, t
daved170 wrote:
> I need help with exceptions raising.
> My goal is to print at the outer functions all the errors including
> the most inner one.
>
> For example:
>
> def foo1(self):
>try:
> foo2()
>except ? :
> print "outer Err at foo1" + ??
>
> def foo2(self):
>tr
Hi!
Take a look at:
http://vis.cs.ucdavis.edu/~ogawa/codeswarm/
code_swarm is a tool that generates a nice visual animation from a
repository history. It also features one with the Python history for
download, enhanced with a few comments.
I hope this isn't old news and you enjoy it!
Uli
--
Hi!
"'abc'.split('')" gives me a "ValueError: empty separator".
However, "''.join(['a', 'b', 'c'])" gives me "'abc'".
Why this asymmetry? I was under the impression that the two would be
complementary.
Uli
--
Sator Laser GmbH
Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932
-
Kermit Mei wrote:
> #!/usr/bin/env
> python
>
> class Test:
> 'My Test class'
> def __init__(self):
> self.arg1 = 1
>
> def first(self):
> return self.arg1
>
> t1 = Test
't1' is now an alternative name for 'Test'. What you wanted instead was to
instantiate 'Test', wh
ganesh wrote:
>> Did you remeber to acquire the GIL? The GIL is global to the process
>
> No, I did not use GIL.
>
> -- Why do we need to use GIL even though python is private to each
> thread?
Quoting from above: "The GIL is global to the process". So no, it is NOT
private to each thread which
Nigel Rantor wrote:
> John Nagle wrote:
>> Immutability is interesting for threaded programs, because
>> immutable objects can be shared without risk. Consider a programming
>> model where objects shared between threads must be either immutable or
>> "synchronized" in the sense that Java uses
kj wrote:
> class Demo(object):
> def fact_iter(n):
> ret = 1
> for i in range(1, n + 1):
> ret *= i
> return ret
>
> def fact_rec(n):
> if n < 2:
> return 1
> else:
> return n * fact_rec(n - 1)
>
> classvar1
Ulrich Eckhardt wrote:
> Jean-Michel Pichavant wrote:
>> class Color:
>> def __init__(self, r, g,b):
>> pass
>> BLACK = Color(0,0,0)
>>
>> It make sens from a design point of view to put BLACK in the Color
>> namespace. But I don&
Jean-Michel Pichavant wrote:
> class Color:
> def __init__(self, r, g,b):
> pass
> BLACK = Color(0,0,0)
>
> It make sens from a design point of view to put BLACK in the Color
> namespace. But I don't think it's possible with python.
class Color:
...
setattrib(Color, "BLACK"
...that is the question!
I have a module which exports a type. It also exports a function that
returns instances of that type. Now, the reason for my question is that
while users will directly use instances of the type, they will not create
instances of the type themselves.
So, the type is a part
joy99 wrote:
> [...] it is giving me output like:
> '\xef\xbb\xbf\xe0\xa6\x85\xe0\xa6\xa8\xe0\xa7\x87\xe0\xa6\x95'
These three bytes encode the byte-order marker (BOM, Unicode uFEFF) as
UTF-8, followed by codepoint u09a8 (look it up on unicode.org what that
is).
In any case, if th
"Martin v. Löwis" wrote:
I have a predefined set of members, some of which are optional.
>>> Having optional fields is also a good reason.
>>
>> What is the use of T_OBJECT_EX vs T_OBJECT in PyMemberDef then?
>
> Right - this works for optional objects. However, it can't possibly
> work for
Tom wrote:
> s = sauce.replace("\n", "")
>
> Sauce is a string, read from a file, that I need to remove newlines
> from. This code works fine in Linux, but not in Windows. rstrip("\n")
> won't work for me, so anybody know how to get this working on Windows?
I'm pretty sure this works regardless o
"Martin v. Löwis" wrote:
>> I have a predefined set of members, some of which are optional.
>
> Having optional fields is also a good reason.
What is the use of T_OBJECT_EX vs T_OBJECT in PyMemberDef then? I would
have though that the former describes an optional field, because the
behaviour of
superpollo wrote:
> i can insert a hex value for a character literal in a string:
>
> >>> stuff = "\x45"
> >>> print stuff
> E
> >>>
>
> can i do something like the above, but using a *binary* number? (e.g.
> 00101101 instead of 45) ?
There are binary number literals since 2.6 and there is th
Hi!
When would I use PyObject_SetAttrString/tp_dictoffset instead of tp_members?
I have a predefined set of members, some of which are optional. The problem
I had with an embedded dictionary was that I can't see its elements using
"dir()". Now I just converted to using tp_members, and it still
per wrote:
> i am using the standard unittest module to unit test my code. my code
> contains several print statements which i noticed are repressed when i
> call my unit tests using:
>
> if __name__ == '__main__':
> suite = unittest.TestLoader().loadTestsFromTestCase(TestMyCode)
> unittes
gganesh wrote:
> I have a dict object like
> emails={'mycontacts': [ 'x...@gmail.com, 'y...@gmail.com',
> 'z...@gmail.com'], 'myname':['gganesh']}
> I need to get the lenght of the list mycontacts ,like
> mycontacts_numbers=3
mycontacts = emails['mycontacts']
mycontacts_number = len(mycontacts)
A
Bearophile wrote:
> For example a novice wants to see 124 / 38 to return the 62/19
> fraction and not 3 or 3.263157894736842 :-)
Python has adopted the latter of the three for operator / and the the second
one for operator //. I wonder if it was considered to just return a
fraction from that opera
Thanks to all that answered, in particular I wasn't aware of the existence
of the __del__ function.
For completeness' sake, I think I have found another way to not really solve
but at least circumvent the problem: weak references. If I understand
correctly, those would allow me to pass out handles
Bearophile wrote:
> Ulrich Eckhardt:
>> a way to automatically release the resource, something
>> which I would do in the destructor in C++.
>
> Is this helpful?
> http://effbot.org/pyref/with.htm
Yes, it aims in the same direction. However, I'm not sure this app
Hi!
I'm currently converting my bioware to handle Python code and I have
stumbled across a problem...
Simple scenario: I have a handle to a resource. This handle allows me to
manipulate the resource in various ways and it also represents ownership.
Now, when I put this into a class, instances to
Robert Kern wrote:
> I wish people would stop representing decimal floating point arithmetic as
> "more accurate" than binary floating point arithmetic.
Those that failed, learned. You only see those that haven't learnt yet.
Dialog between two teachers:
T1: Oh those pupils, I told them hundred ti
krishna wrote:
> I need to convert 1010100110 boolean value to some think like 2345, if
> its possible then post me your comment on this
Yes, sure. You can simply sum up the digit values and then format them as
decimal number. You can also just look up the number:
def decode_binary(input):
Ben Finney wrote:
> Paul Watson writes:
>> On Mon, 2009-04-13 at 17:03 +0200, WP wrote:
>> > dict = {1:'astring', 2:'anotherstring'}
>> > for key in dict.keys():
>> > print 'Press %i for %s' % (key, dict[key])
>>
>> In addition to the comments already made, this code will be quite
>> broken
Dave Angel wrote:
> Ulrich Eckhardt wrote:
>> open() doesn't take a string as second parameter, see 'help(open)'.
>> Instead, it takes one of the integers which are defined as symbols in the
>> os module, see 'dir(os)'.
>
> [...]The second
jeni wrote:
[ ..large backtrace.. ]
For your own sake and that of your readers, try next time to reduce the code
that causes the problems to a minimal example. This prevents people from
guessing or simply ignoring your problems.
> /home/Activities/Kremala.activity/Kremala.py in insert_text_file
>
Cassian Braconnier wrote:
> [...] completely broke Synaptic, and made it impossible to install any
> (other, non python) package with apt-get or dpkg commands.
This is not a Python error and it doesn't actually belong here.
> So far I could not get any useful advice on the french ubuntu users
> f
casebash wrote:
> I know the bin function converts an int into a binary string.
Binary string sounds ambiguous. Firstly, everything is binary. Secondly,
strings are byte strings or Unicode strings. In any case, I'm not 100% sure
what you mean - giving an example of input and output would help!
>
Hi!
I need to pack a floating point value into a vector of 32-bit unsigned
values in IEEE format. Further, I maintain a CRC32 checksum for integrity
checking. For the latter, I actually need the float as integral value.
What I currently do is this:
tmp = struct.pack("=f", f)
(i,) = struct.un
Stef Mientki wrote:
> I've to distribute both python files and data files.
> Everything is developed under windows and now the datafiles contains
> paths with mixed \\ and /.
For your info: Some (!!!) parts of MS Windows understand forward slashes as
path separators and disallows them in file name
boblat...@googlemail.com wrote:
> this is the conversion I'm looking for:
>
> ['1.1', '2.2', '3.3'] -> (1.1, 2.2, 3.3)
>
> Currently I'm "disassembling" the list by hand, like this:
>
> fields = line.split('; ')
> for x in range(len(fields)):
> fields[x] = float(fields[x])
>
Steve Ferg wrote:
> On the one hand, there are developers who love big IDEs with lots of
> features (code generation, error checking, etc.), and rely on them to
> provide the high level of support needed to be reasonably productive
> in heavy-weight languages (e.g. Java).
>
> On the other hand the
Adam Gaskins wrote:
> Long story short, I'm tired of doing things in such a hackish manner
> and want to write applications that are cross platform (I'd like to
> get our production dept on linux eventually) and truely object
> oriented.
Adam, there is one notion here that I seriously dislike: yo
Hi!
We have a few tests for some module here. These tests are under development
and applied to older versions (with less features) of the module, too. That
means that if I have module version 42, tests A and B can not possibly
work. I don't want to have test failures but I also don't want to fork
Justin Rajewski wrote:
> I need to print variables out over serial, however I need them to not be
> in ASCII, ie if the variable is 5 then print 5 not "5".
>
> The function that writes to the serial port requires a string and I can
> send non-variables out with the string "/x05" for 5.
Take a loo
Steven D'Aprano wrote:
> On Fri, 24 Apr 2009 03:00:26 -0700, GC-Martijn wrote:
>> t = Test()
>> if (t == 'Vla':
>> print t # must contain Vla
>
>
> What's wrong with that?
It unnecessarily injects the name 't' into the scope.
Uli
--
Sator Laser GmbH
Geschäftsführer: Thorsten Föcking, Amts
Carbon Man wrote:
> self.dataUpdate.write(u"\nentry."+node.tagName+ u" = " + cValue)
> cValue contains a unicode character. node.tagName is also a unicode string
> though it has no special characters in it.
> Getting the error:
> UnicodeEncodeError: 'ascii' codec can't encode character u'\x93' in
>
Johannes Bauer wrote:
> What I'd like to add: I want the GUI users to supply plugin scripts,
> i.e. offer some kind of API. That is, I want the user to write short
> Python pieces which look something like
>
> import guiapp
>
> class myplugin():
> def __init__(self):
> guiapp.add_menu("foobar")
>
Ulrich Eckhardt wrote:
[how to handle bitfields and enumerations in Python]
Thanks to all that answered. The important lessons I learned:
* You can modify classes, other than in C++ where they are statically
defined. This allows e.g. adding constants.
* __repr__ should provide output suitable
Greetings!
I'm currently using Python to implement a set of tests for code that is
otherwise written in C. This code was wrapped using Boost.Python and is
then loaded into Python as module.
What I often have in C is this:
// bitfield (several flags combined)
#define STATUS_OVERTEMP 1u
#def
Gilles Ganault wrote:
> test = "t...@gmail.com"
> isp = ["gmail.com", "yahoo.com"]
> for item in isp:
> if test.find(item):
> print item
> === output
> gmail.com
> yahoo.com
> ===
>
> Any idea why I'm also getting "yahoo.com"?
find() returns the index where it is found or -1 if it is not
grbgooglefan wrote:
> How can I build a release and not the debug version of libpython.a?
> I have seen that there are assert, abort statements in lot many
> functions in Python code. I would like to avoid those when compiling
> the libpython.a library because when this libpython gets used for
> pr
Doerte wrote:
> from pylab import *
> from numpy import *
> from scipy import *
> from math import *
Don't do this, read the style guide on writing Python code.
> res = integrate.quad(func=f, a=x0, b=x1)
[...]
> NameError: name 'integrate' is not defined
# try this instead
from scipy import inte
Grant Edwards wrote:
> with open(filename,"rb") as f:
> while True:
> buf = f.read(1)
> if not buf: break
> # do something
The pattern
with foo() as bar:
# do something with bar
is equivalent to
bar = foo()
if bar:
# do something with bar
except
mattia wrote:
> How can I convert the following string:
>
> 'AAR','ABZ','AGA','AHO','ALC','LEI','AOC',
> EGC','SXF','BZR','BIQ','BLL','BHX','BLQ'
>
> into this sequence:
>
> ['AAR','ABZ','AGA','AHO','ALC','LEI','AOC',
> EGC','SXF','BZR','BIQ','BLL','BHX','BLQ']
import string
string.split("a,b,c
Raymond Hettinger wrote:
>> The idea is to make numbering formatting a little easier with
>> the new format() builtin:
>> http://docs.python.org/library/string.html#formatspec
[...]
> Scanning the web, I've found that thousands separators are
> usually one of COMMA, PERIOD, SPACE, or UNDERSCORE. T
Greg Miller wrote:
> I would like to know if there is a way of starting the GUI
> without the DOS window having to launch?
Use pythonw.exe instead of python.exe.
Uli
--
Sator Laser GmbH
Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932
--
http://mail.python.org/mailman/listinf
Hi!
I have a socket from which I would like to parse some data, how would I do
that? Of course, I can manually read data from the socket until unpack()
stops complaining about a lack of data, but that sounds rather inelegant.
Any better suggestions?
Uli
--
Sator Laser GmbH
Geschäftsführer: Tho
psaff...@googlemail.com wrote:
> I'm building a pipeline involving a number of shell tools. In each
> case, I create a temporary file using tempfile.mkstmp() and invoke a
> command ("cmd < /tmp/tmpfile") on it using subprocess.Popen.
>
> At the end of each section, I call close() on the file handl
thomasvang...@gmail.com wrote:
> C:\python30> patch -p0 < fileio_buffer.patch
> The patch command is not recognized..
You need the 'patch' program first. Further, you will need a C compiler. If
you don't know how to compile from sources, I would postpone patching
sources to after learning that.
>
301 - 400 of 434 matches
Mail list logo