mstagliamonte wrote:
> Hi everyone,
>
> I am a beginner in python and trying to find my way through... :)
>
> I am writing a script to get numbers from the headers of a text file.
>
> If the header is something like:
> h01 = ('>scaffold_1')
> I just use:
> h01.lstrip('>scaffold_')
> and this re
alex23 wrote:
> def get_transcript_and_size(line):
> columns = line.strip().split()
> return columns[0].strip(), int(columns[1].strip())
You can remove all strip() methods here as split() already strips off any
whitespace from the columns.
Not really important, but the nitp
Michael wrote:
> I'm writing a decorator that I never want to be nested. Following from the
> answer on my StackOverflow question
> (http://stackoverflow.com/a/16905779/106244), I've adapted it to the
> following.
>
> Can anyone spot any issues with this? It'll be run in a multi-threaded
> enviro
lionelgreenstr...@gmail.com wrote:
> Sorry for my quote,
> but do you have any suggestion?
>> After 30seconds (more or less) the program crashes: seems a buffer
>> problem, but i'm not really sure.
>>
>> What's wrong?
I don't use qt or pyserial myself, but your problem description is too vague
ethereal_r...@hotmail.com wrote:
> Hello, I'm working with PostgreSQL and Python to obtain 2 columns froma
> database and need to print it in a specific format.
>
> Here is my current code.
>
>
>
> #!/usr/bin/python
> # -*- coding: utf-8 -*-
>
> import psycopg2
> import sys
>
> con = None
>
Tim Chase wrote:
> On 2013-06-07 23:46, Jason Swails wrote:
>> On Fri, Jun 7, 2013 at 10:32 PM, Tim Chase
>> > def calculate(params):
>> > a = b = 0
>> > if some_calculation(params):
>> > a += 1
>> > if other_calculation(params):
>> > b += 1
>> > return (a, b)
>> >
>>
claire morandin wrote:
> I have the following script which does not return anything, no apparent
> mistake but my output file is empty.I am just trying to extract some
> decimal number from a file according to their names which are in another
> file. from collections import defaultdict import nump
claire morandin wrote:
> Thanks Peter, true I did not realize that ercc_contigs is empty, but I am
> not sure how to "populate" the dictionary if I only have one column for
> the value but no key
You could use a "dummy value"
ercc_contigs = {}
for line in op
Rui Maciel wrote:
> Let:
> - class Point be a data type which is used to define points in space
> - class Line be a data type which possesses an aggregate relationship with
> objects of type Point
> - class Model be a container class which stores collections of Point and
> Line objects
>
>
> Ess
Rui Maciel wrote:
> Peter Otten wrote:
>
>> Don't add
>>
>>>position = []
>>
>> to your code. That's not a declaration, but a class attribute and in the
>> long run it will cause nothing but trouble.
>
> Why's that?
Especial
Rui Maciel wrote:
> How do you guarantee that any object of a class has a specific set of
> attributes?
You don't.
Such a guarantee is like the third wheel on a bike -- it doesn't improve the
overall experience.
PS: I'd rather not mention the memory-saving technique that is sometimes
abused,
Rui Maciel wrote:
> Peter Otten wrote:
>
>> Rui Maciel wrote:
>>
>>> How do you guarantee that any object of a class has a specific set of
>>> attributes?
>>
>> You don't.
>
>
> What's your point regarding attribute assignme
Rui Maciel wrote:
> Peter Otten wrote:
>
>> I don't understand the question. My original point was that you should
>> omit class attributes that don't fulfill a technical purpose.
>>
>
> You've said the following:
>
>
>> class Point
Chris Angelico wrote:
> On Tue, Jun 11, 2013 at 6:34 AM, Roy Smith wrote:
>> new_songs = [s for s in songs if s.is_new()]
>> old_songs = [s for s in songs if not s.is_new()]
>
> Hmm. Would this serve?
>
> old_songs = songs[:]
> new_songs = [songs.remove(s) or s for s in songs if s.is_new()]
>
Fábio Santos wrote:
> On 10 Jun 2013 23:54, "Roel Schroeven" wrote:
>>
>> You could do something like:
>>
>> new_songs, old_songs = [], []
>> [(new_songs if s.is_new() else old_songs).append(s) for s in songs]
>>
>> But I'm not sure that that's any better than the long version.
>
> This is so be
Terry Jan Reedy wrote:
> Many long-time posters have advised "Don't rebind built-in names*.
I'm in that camp, but I think this old post by Guido van Rossum is worth
reading to put the matter into perspective:
"""
> That was probably a checkin I made. I would have left it alone except the
> cod
rusi wrote:
> On Jun 11, 12:09 pm, Peter Otten <__pete...@web.de> wrote:
>> Terry Jan Reedy wrote:
>> > Many long-time posters have advised "Don't rebind built-in names*.
>>
>> I'm in that camp, but I think this old post by Guido van Rossum is
Chris Angelico wrote:
> On Wed, Jun 12, 2013 at 1:28 AM, Serhiy Storchaka
> wrote:
>> 11.06.13 01:50, Chris Angelico написав(ла):
>>
>>> On Tue, Jun 11, 2013 at 6:34 AM, Roy Smith wrote:
new_songs = [s for s in songs if s.is_new()]
old_songs = [s for s in songs if not s.is_new()]
Joshua Landau wrote:
> On 11 June 2013 01:11, Peter Otten <__pete...@web.de> wrote:
>> def partition(items, predicate=bool):
>> a, b = itertools.tee((predicate(item), item) for item in items)
>> return ((item for pred, item in a if not pred),
>>
Adam Mercer wrote:
> Hi
>
> I'm trying to update one of my scripts so that it runs under python2
> and python3, but I'm running into an issue that the following example
> illustrates:
>
> $ cat test.py
> try:
> # python-2.x
> from urllib2 import urlopen
> from ConfigParser import ConfigPar
Ronny Mandal wrote:
> Hello,
>
> I am trying to write a script which will parse a code segment (with
> ast.parse()), locate the correct function/method node (by name) in the
> resulting tree and replace this function (node) with another function
> (node), e.g.:
>
> MyMod1.py:
>
> class FooBar()
Jayakrishnan Damodaran wrote:
> I have a class which calculates some salary allowances. Instead of a blind
> calculation I need to check some conditions before I can return the
> calculated amount. Like if all the allowances calculated till now plus the
> one in progress must not exceed the total
Giorgos Tzampanakis wrote:
> I have a program that saves lots (about 800k) objects into a shelve
> database (I'm using sqlite3dbm for this since all the default python dbm
> packages seem to be unreliable and effectively unusable, but this is
> another discussion).
>
> The process takes about 10-
Chris Rebert wrote:
> On Jun 14, 2013 10:26 PM, wrote:
>> What is the thinking behind stopping 'one short' when slicing or
>> iterating through lists?
> I find Dijkstra's explanation rather convincing:
> http://www.cs.utexas.edu/~EWD/transcriptions/EWD08xx/EWD831.html
This is the only case whe
Giorgos Tzampanakis wrote:
> So it seems that the pickle module does keep some internal cache or
> something like that.
I don't think there's a global cache. The Pickler/Unpickler has a per-
instance cache (the memo dict) that you can clear with the clear_memo()
method, but that doesn't matter
sixtyfourbit wrote:
> I'm in the first chapter of Natural Language Processing with Python and am
> trying to run the example .dispersion_plot. I am using Python 2.7.4
> (Anaconda) on Mac OSX 10.8.
>
> When I load all of the necessary modules and try to create the dispersion
> plott, I get no retu
Alan Newbie wrote:
> Hello,
> Let's say I want to compare two csv files: file A and file B. They are
> both similarly built - the first column has product IDs (one product per
> row) and the columns provide some stats about the products such as sales
> in # and $.
>
> I want to compare these file
jfhar...@gmail.com wrote:
> Hi,
>
> Sorry if this appears twice, I sent it to the mailing list earlier and the
> mail seems to have been swallowed by the black hole of email vagaries.
>
> We have a class which executes external processes in a controlled
> environment and does "things" specified
Jason Friedman wrote:
> I have XML which looks like:
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> The "Property X" string appears twice times and I want to output the
> "path"
> that leads to all such appearances. In this case the output would be:
>
> LEVE
nickgan@windowslive.com wrote:
> I have recently started to solve my first Python problems but I came
> across to this:
> Write a version of a palindrome recogniser that accepts a file name from
> the user, reads each line, and prints the line to the screen if it is a
> palindrome.(by http://w
Hans wrote:
> Hi,
>
> I'm doing a regular expression matching, let's say
> "a=re.search(re_str,match_str)", if matching, I don't know how many
> str/item will be extracted from re_str, maybe a.group(1), a.group(2) exist
> but a.group(3) does not.
>
> Can I somehow check it? something like:
> if
Yves S. Garret wrote:
> Hi, I have a question about breaking up really long lines of code in
> Python.
>
> I have the following line of code:
> log.msg("Item wrote to MongoDB database %s/%s" %(settings['MONGODB_DB'],
> settings['MONGODB_COLLECTION']), level=log.DEBUG, spider=spider)
>
> Given th
Chris Angelico wrote:
> On Fri, Jun 21, 2013 at 7:15 PM, Peter Otten <__pete...@web.de> wrote:
>> Combining these modifications:
>>
>> for line in f:
>> word = line.strip()
>> if is_palindrome.is_palindrome(word):
>> print word
>
Борислав Бориславов wrote:
> while 1:
> name=raw_input("What is your name? ")
> if name == "bobi": print "Hello Master!" and break
> else: print "error"
> I want if my conditions are met to do a couple of things and i cant do
> that
> while 1:
> name=raw_input("What is your name?
pablobarhamal...@gmail.com wrote:
> Hi there! I'm quite new to programming, even newer in python (this is
> actually the first thing I try on it), and every other topic I've seen on
> forums about my problem doesn't seem to help.
>
> So, the following lines are intended to draw a white square (wh
Phu Sam wrote:
> I have a method that opens a file, lock it, pickle.load the file into a
> dictionary.
> I then modify the status of a record, then pickle.dump the dictionary back
> to the file.
>
> The problem is that the pickle.dump never works. The file never gets
> updated.
>
> def updateSta
Marco Perniciaro wrote:
> Hi,
> I've been working with Python for a long time.
> Yet, I came across an issue which I cannot explain.
>
> Recently I have a new PC (Windows 7).
> Previously I could call a Python script with or without the "python" word
> at the beginning. Now the behavior is differ
Tim wrote:
> I am extending a parser and need to create many classes that are all
> subclassed from the same object (defined in an external library). When my
> module is loaded I need all the classes to be created with a particular
> name but the behavior is all the same. Currently I have a bunch
Tim wrote:
> I am not completely understanding the type function I guess. Here is an
> example from the interpreter:
>
> In [1]: class MyClass(object):
>...: pass
>...:
> In [2]: type('Vspace', (MyClass,), {})
> Out[2]: __main__.Vspace
> In [3]: x = Vspace()
>
---
Joshua Landau wrote:
> I would say if a dict isn't good, there are still some cases where you
> might not want to use globals.
>
> I _might_ do:
> # Make a module
> module_for_little_classes = ModuleType("module_for_little_classes",
> "All the things")
> module_for_little_classes.__dict__.update
John Reid wrote:
> Looking at the docs for warnings.simplefilter
> (http://docs.python.org/2/library/warnings.html) I think the following
> script should only produce one warning at each line as any message is
> matched by the simple filter
>
> import warnings
> warnings.simplefilter('default')
>
Vincent Davis wrote:
> I have a list of a list of integers. The lists are long so i cant really
> show an actual example of on of the lists, but I know that they contain
> only the integers 1,2,3,4. so for example.
> s2 = [[1,2,2,3,2,1,4,4],[2,4,3,2,3,1]]
>
> I am calculating the product, sum, ma
cts.private.ya...@gmail.com wrote:
> I'd like to use closures to set allow a subroutine to set variables in its
> caller, in leu of pointers.
"leu"? Must be a Fench word ;)
> But I can't get it to work. I have the
> following test pgm, but I can't understand its behaviour:
>
> It uses a functi
cts.private.ya...@gmail.com wrote:
> As for python 3 ... "nonlocal"? I see I'm not alone in picking obnoxious
> names ...
tous chez...
> Alas, one reason it's a weak workaround is that it doesn't work - at
> least, not how I wish it would:
> $ cat ptrs
>
> x = 34
>
> def p1 (a1):
>
> a1
Helmut Jarausch wrote:
> Hi,
>
> I have a strange error. When I try import idlelib.PyShell from Python3.3
> it fails with
>
> Python 3.3.2+ (3.3:68ff68f9a0d5+, Jun 30 2013, 12:59:15)
> [GCC 4.7.3] on linux
> Type "help", "copyright", "credits" or "license" for more information.
import idlel
On Sat, 29 Jun 2013 10:28:47 -0700 (PDT), gmsid...@gmail.com wrote:
> I was wondering if there was a couple of words or things i
> could add to the top of my python script to password
> protect it so that it asks user for the password and then
> after three tries it locks them out or says "access
>
Ven wrote:
> I use: Python 2.6 and sqlalchemy 0.6.1
>
> This is what I am trying to do:
>
> from sqlalchemy.types import (
> Integer,
> String,
> Boolean
> )
> from sqlalchemy.ext.declarative import declarative_base
>
> Base = declarative_base()
>
> class SampleMeta(type):
> def __
Joshua Landau wrote:
> On 3 July 2013 23:19, Joshua Landau wrote:
>> If you don't want to do that, you'd need to use introspection of a
>> remarkably hacky sort. If you want that, well, it'll take a mo.
>
> After some effort I'm pretty confident that the hacky way is impossible.
Well, technical
Steven D'Aprano wrote:
> Well, if I ever have more than 63,000,000 variables[1] in a function,
> I'll keep that in mind. Until then, I'm pretty sure you can trivially
> avoid name clashes with globals that you wish to avoid clashing with.
> [1] Based on empirical evidence that Python supports nam
Rotwang wrote:
> Sorry to be OT, but this is sending my pedantry glands haywire:
We are mostly pedants, too -- so this is well-deserved...
> On 04/07/2013 08:06, Dave Angel wrote:
>> On 07/04/2013 01:32 AM, Steven D'Aprano wrote:
>>>
>>
>>>
>>> Well, if I ever have more than 63,000,000
Russel Walker wrote:
> Since I've already wasted a thread I might as well...
>
> Does this serve as an acceptable solution?
>
> def supersum(sequence, start=0):
> result = type(start)()
> for item in sequence:
> try:
> result += supersum(item, start)
> except:
skunkwerk wrote:
> Hi,
> I'm using a custom pickler that replaces any un-pickleable objects (such
> as sockets or files) with a string representation of them, based on the
> code from Shane Hathaway here:
> http://stackoverflow.com/questions/4080688/python-pickling-a-dict-with-
some-unpickla
skunkwerk wrote:
> On Monday, July 8, 2013 12:45:55 AM UTC-7, Peter Otten wrote:
>> skunkwerk wrote:
>>
>>
>>
>> > Hi,
>>
>> > I'm using a custom pickler that replaces any un-pickleable objects
>> > (such
>>
>
Ulrich Eckhardt wrote:
> Hello!
>
> I just stumbled over a case where Python (2.7 and 3.3 on MS Windows)
> fail to detect that an object is a function, using the callable()
> builtin function. Investigating, I found out that the object was indeed
> not callable, but in a way that was very unexpec
Steven D'Aprano wrote:
> On Fri, 12 Jul 2013 07:36:30 +, Duncan Booth wrote:
>
>> To be a convincing use-case you would have to show a situation where
>> something had to be both a static method and a utility method rather
>> than just one or the other and also where you couldn't just have bo
L O'Shea wrote:
> Hi all,
> I've been asked to take over a project from someone else and to extend the
> functionality of this. The project is written in Python which I haven't
> had any real experience with (although I do really like it) so I've spent
> the last week or two settling in, trying to
Joshua Landau wrote:
> On 12 July 2013 11:45, Devyn Collier Johnson
> wrote:
>> Could you explain what you mean? What and where is the new Flexible
>> String Representation?
>
> Do not worry. jmf is on about his old rant comparing broken previous
> versions of Python to newer ones which in some
pe...@ifoley.id.au wrote:
> Hi List,
>
> I am new to Python and wondering if there is a better python way to do
> something. As a learning exercise I decided to create a python bash
> script to wrap around the Python Crypt library (Version 2.7).
>
> My attempt is located here - https://gist.git
fronag...@gmail.com wrote:
> Hm. My apologies for not being very clear. What I'm doing is this:
>
> self.loader_thread = Thread(target=self.loadpages,
> name="loader_thread")
> self.loader_thread.start()
> while self.loader_thread.isAliv
pablobarhamal...@gmail.com wrote:
> Ok, I'm working on a predator/prey simulation, which evolve using genetic
> algorithms. At the moment, they use a quite simple feed-forward neural
> network, which can change size over time. Each brain "tick" is performed
> by the following function (inside the
Chris Hinsley wrote:
> On 2013-07-22 18:36:41 +, Chris Hinsley said:
>
>> Folks, I have this decorator:
>>
>> def memoize(maxsize):
>> def _memoize(func):
>> lru_cache = {}
>> lru_list = []
>
> Other clues, I use it on a recursive function:
>
> @memoize(64)
> def next_m
malay...@gmail.com wrote:
> I faced a problem: to implement appropriate search program I need to tick
> few checkboxes which turned out to have the same name (name="a",
> id="a1","a2","a3","a4"). Set_input('a', True) does not work (I use Grab
> library),
For all but the most popular projects a u
en...@yandex.ru wrote:
> This is my first post, nice to meet you all!
Welcome!
> I`m biology student from Russia, trying to learn python to perform some
>
> simple simulations.
>
> Here`s my first problem.
> I`m trying to perform some simple 2d vector rotations in pygame, in order
>
> to lear
Ethan Furman wrote:
> So, my question boils down to: in Python 3 how is dict.keys() different
> from dict? What are the use cases?
I just grepped through /usr/lib/python3, and could not identify a single
line where some_object.keys() wasn't either wrapped in a list (or set,
sorted, max) call,
Oscar Benjamin wrote:
> On Jul 24, 2013 7:25 AM, "Peter Otten" <__pete...@web.de> wrote:
>>
>> Ethan Furman wrote:
>>
>> > So, my question boils down to: in Python 3 how is dict.keys()
>> > different
>> > from dict? What are t
Chris Angelico wrote:
> On Thu, Jul 25, 2013 at 5:04 PM, Steven D'Aprano
> wrote:
>> - Views support efficient (O(1) in the case of keys) membership testing,
>> which neither iterkeys() nor Python2 keys() does.
>
> To save me the trouble and potential error of digging through the
> source code:
Ian Kelly wrote:
> On Thu, Jul 25, 2013 at 2:13 AM, Peter Otten <__pete...@web.de> wrote:
>> Chris Angelico wrote:
>>
>>> On Thu, Jul 25, 2013 at 5:04 PM, Steven D'Aprano
>>> wrote:
>>>> - Views support efficient (O(1) in the case of key
ty...@familyrobbins.com wrote:
> I'm a bit new to python and I'm trying to create a simple program which
> adds words and definitions to a list, and then calls them forward when
> asked to.
> while escape < 1:
>
> choice = input("Type 'Entry' to add a word to the Dictionary, 'Search'
> t
malay...@gmail.com wrote:
> вторник, 23 июля 2013 г., 11:25:00 UTC+4 пользователь Peter Otten написал:
>> malay...@gmail.com wrote:
>> For all but the most popular projects a url works wonders. I'm assuming
>> http://grablib.org
> Well, I have read the documentat
syed khalid wrote:
> I am trying to do a "import shogun" in my python script. I can invoke
> shogun with a command line with no problem. But I cannot with a python
> import statement.
>
>>invoking python from a command line...
>
> Syedk@syedk-ThinkPad-T410:~/shogun-2.0.0/src/interfac
Joseph L. Casale wrote:
>> Has anyone encountered this and utilized other existing functions
>> within the shipped 3.6.21 sqlite version to accomplish this?
>
> Sorry guys, forgot about create_function...
Too late, I already did the demo ;)
>>> import sqlite3
>>> db = sqlite3.connect(":memory:"
Devyn Collier Johnson wrote:
> On Python3, how can I perform bitwise operations? For instance, I want
> something that will 'and', 'or', and 'xor' a binary integer.
>>> 0b1010 | 0b1100
14
>>> bin(_)
'0b1110'
>>> 0b1010 & 0b1100
8
>>> bin(_)
'0b1000'
>>> 0b1010 ^ 0b1100
6
>>> bin(_)
'0b110'
--
CWr wrote:
> Some years ago I started a small WSGI project at my university. Since then
> the project was grown up every year. Some classes have more than 600 lines
> of code with (incl. boiler-plates mostly in descriptors/properties).
>
> Many of these properties are similar or have depencies am
shearich...@gmail.com wrote:
> Listening to 'Radio Free Python' episode 8
> (http://radiofreepython.com/episodes/8/ - around about the 30 minute mark)
> I heard that Python pre creates some integer constants to avoid a
> proliferation of objects with the same value.
>
> I was interested in this a
Johann Spies wrote:
> I am trying the following:
>
> Change data like this:
>
> Bien Donné : agri tourism
>
> to this:
>
> Bien Donné agri tourism
>
> I am using the 'unescape' function published on
> http://effbot.org/zone/re-sub.htm#unescape-html but working through a file
> I get the follo
Rotwang wrote:
> Hi all, I have a module that saves and loads data using cPickle, and
> I've encountered a problem. Sometimes I want to import the module and
> use it in the interactive Python interpreter, whereas sometimes I want
> to run it as a script. But objects that have been pickled by runn
Josh English wrote:
> I'm creating a cmd.Cmd class, and I have developed a helper method to
> easily handle help_xxx methods.
>
> I'm trying to figure out if there is an even lazier way I could do this
> with decorators.
>
> Here is the code:
> *
> import cmd
>
>
> def add_
gmspro wrote:
> Why is python source code not available on github?
>
> Make it available on github so that we can git clone and work on source
> code.
http://thread.gmane.org/gmane.comp.python.devel/121885/focus=122111
--
http://mail.python.org/mailman/listinfo/python-list
Josh English wrote:
> On Sunday, June 24, 2012 1:07:45 AM UTC-7, Peter Otten wrote:
>>
>> You cannot access a class instance because even the class itself doesn't
>> exist yet. You could get hold of the class namespace with
>> sys._getframe(),
>>
>&
Peter Otten wrote:
>>>helpfunc = getattr(self, "do_" + name[5:]).help
>
> i. e. it looks for getattr(self, "do_help") which does exist and then
Sorry that should be getattr(self, "do_done").
--
http://mail.python.org/mailman/listinfo/python-list
Alister wrote:
> I think I may be on firmer grounds with the next few:
>
> isValidPassword can be simplified to
>
> def isValidPassword(password:
> count=len(password)
> return count>= mud.minpass and count<= mud.maxpass
>
> ( I used count to save finding the length of password
levi nie wrote:
> i love python very much.it's powerful,easy and useful.
> i got it from Openstack.And i'm a new guy on python.
Welcome!
> Can i ask some stupid questions in days? haha...
Sure, but we cannot guarantee that the answer will be stupid, too ;)
--
http://mail.python.org/mailman/li
subhabangal...@gmail.com wrote:
> On Thursday, July 5, 2012 4:51:46 AM UTC+5:30, (unknown) wrote:
>> Dear Group,
>>
>> I am Sri Subhabrata Banerjee trying to write from Gurgaon, India to
>> discuss some coding issues. If any one of this learned room can shower
>> some light I would be helpful eno
subhabangal...@gmail.com wrote:
[Please don't top-post]
>> start = 0
>> for match in re.finditer(r"\$", data):
>> end = match.start()
>> print(start, end)
>> print(data[start:end])
>> start = match.end()
> That is a nice one. I am thinking if I can write "for lines in f" sort of
Frederic Rentsch wrote:
> I'm sorry I can't post an intelligible piece that does NOT work. I
> obviously can't post the whole thing.
How about a pastebin then? Or even bitbucket/github as you need to track
changes anyway?
> It is way too convoluted.
"Convoluted" code is much easier to debug t
Terry Reedy wrote:
> On 7/13/2012 4:24 PM, Frederic Rentsch wrote:
>> On Fri, 2012-07-13 at 09:26 +0200, Peter Otten wrote:
>
>>> Another random idea: run your code on a more recent python/tcl
>>> installation.
>
> That might have been clearer as python +
Philipp Hagemeister wrote:
> Currently, $ python -m unittest does nothing useful (afaik). Would it
> break anything to look in . , ./test, ./tests for any files matching
> test_* , and execute those?
http://docs.python.org/library/unittest#test-discovery
--
http://mail.python.org/mailman/lis
andrea crotti wrote:
> 2012/7/16 Christian Heimes :
>>
>> The OSError isn't catched as the code never reaches the line with "raise
>> OSError". In other words "raise OSError" is never executed as the
>> exception raised by "assert False" stops the context manager.
>>
>> You should avoid testing mo
andrea crotti wrote:
> Good thanks, but there is something that implements this behaviour..
> For example nose runs all the tests, and if there are failures it goes
> on and shows the failed tests only in the end, so I think it is
> possible to achieve somehow, is that correct?
No, I don't see ho
Tim Chase wrote:
> tim@laptop:~/tmp$ python
> Python 2.6.6 (r266:84292, Dec 26 2010, 22:31:48)
> [GCC 4.4.5] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
import csv
from cStringIO import StringIO
s = StringIO('Email\n...@example.com\n...@example
larry.mart...@gmail.com wrote:
> It seems that if you do a list(group) you have consumed the list. This
> screwed me up for a while, and seems very counter-intuitive.
Many itertools functions work that way. It allows you to iterate over the
items even if there is more data than fits into memory.
Alex van der Spek wrote:
> I use this formatter in logging:
>
> formatter = logging.Formatter(fmt='%(asctime)s \t %(name)s \t
> %(levelname)s \t %(message)s')
>
> Sample output:
>
> 2012-07-19 21:34:58,382 root INFO Removed - C:\Users\ZDoor\Documents
>
> The time stamp has millisecond pr
Jason Veldicott wrote:
> subprocess.Popen(["C:\\Program Files
> (x86)\\Java\\jdk1.7.0_05\\bin\\java.exe", "-cp
> c:\\antlr\\antlr-3.4-complete.jar org.antlr.Tool",
> "C:\\Users\\Jason\\Documents\\antlr\\java grammar\\Java.g"],
> stdout=subprocess.PIPE, shell=True ).communicate()
>
>
> Obviously,
Lipska the Kat wrote:
> Greetings Pythoners
>
> A short while back I posted a message that described a task I had set
> myself. I wanted to implement the following bash shell script in Python
>
> Here's the script
>
> sort -nr $1 | head -${2:-10}
>
> this script takes a filename and an optiona
Tony the Tiger wrote:
> On Sun, 22 Jul 2012 11:39:30 -0400, Roy Smith wrote:
>
>> To answer the question you asked, to convert a list of strings to a list
>> of ints, you want to do something like:
>>
>> MODUS_LIST = [int(i) for i in options.modus_list]
>
> Thanks. I'll look into that. I now
Sarbjit singh wrote:
> I am writing a script in which in the external system command may
> sometimes require user input. I am not able to handle that properly. I
> have tried using os.popen4 and subprocess module but could not achieve the
> desired behavior.
>
> Below mentioned example would show
Laszlo Nagy wrote:
> I do not want this program to generate very long identifiers. It would
> increase SQL parsing time, and don't look good. Let's just say that the
> limit should be 32 characters. But I also want to recognize the
> identifiers when I look at their modified/truncated names.
Real
Alan Franzoni wrote:
> Hello,
> I think I'm missing some piece here.
>
> I'm trying to register a default error handler for handling exceptions
> for preventing encoding/decoding errors (I know how this works and that
> making this global is probably not a good practice, but I found this
> strang
andrea crotti wrote:
> I have some complex input to parse (with regexps), and I would like to
> create nice objects directy from them.
> The re module doesn't of course try to conver to any type, so I was
> playing around to see if it's worth do something as below, where I
> assign a constructor t
Benoist Laurent wrote:
> I'm impletting a tool in Python.
> I'd like this tool to behave like a standard unix tool, as grep for
> exemple. I chose to use the argparse module to parse the command line and
> I think I'm getting into several limitations of this module.
>
>> First Question.
> How can
201 - 300 of 9315 matches
Mail list logo