2012/6/6 Diego Uribe Gamez
>
> Una pregunta, como puedo listar todas las librerías que puedo importar a
> un .py? y de sus clases? en la terminal de Linux Debian, algo así como
> cuando listo todos los programas usando "# aptitude search nombre"
>
> Se que entro a otra terminal usando "# Python"
>
n Wed, Jun 13, 2012 at 7:29 PM, bruce g wrote:
> What is the best way to parse a CSV string to a list?
Use the `csv` module:
http://docs.python.org/library/csv.html
http://www.doughellmann.com/PyMOTW/csv/
The `StringIO` module can be used to wrap your string as a file-like
object for consumption
On Thu, Jun 14, 2012 at 12:40 AM, Hemanth H.M wrote:
list(literal_eval('"aa","bb 'b'","cc"'))
> ['aa', 'bb ', 'cc']
>
> Strange?
Not really. You didn't properly escape the embedded quotation marks in
the string itself!
So before anything ever even gets passed to literal_eval(), that part
is
On Thu, Jun 2, 2011 at 2:54 AM, loial wrote:
> I need to pass some sort of array or hashmap from Java and read the
> data in a python script (which will be called by the java class). Is
> there any neater way to do this other than just passing strings?
Jython?: http://www.jython.org/
Or dependi
On Thu, Jun 2, 2011 at 3:47 AM, loial wrote:
> Unfortunately using jpython or json are not options at the moment
What rules out JSON that does not also rule out the "just passing
strings" approach?
What about (*shudder*) XML? (Can't believe I just said that...)
Cheers,
Chris
--
http://mail.pyt
On Sun, Jun 5, 2011 at 8:55 PM, Gnarlodious wrote:
> Say I send a request like this:
> http://0.0.0.0/Sectrum/Gnomon?see=Gnomon&order=7&epoch=1303541219
>
> This makes for a CGIform of the CGI Tuple Object type:
> FieldStorage(None, None, [MiniFieldStorage('see', 'Gnomon'),
> MiniFieldStorage('ord
On Mon, Jun 6, 2011 at 9:15 AM, Jabba Laci wrote:
> Hi,
>
> I'd like to simplify the following string formatting:
>
> solo = 'Han Solo'
> jabba = 'Jabba the Hutt'
> print "{solo} was captured by {jabba}".format(solo=solo, jabba=jabba)
> # Han Solo was captured by Jabba the Hutt
>
> What I don't li
On Tue, Jun 7, 2011 at 2:36 PM, Friedrich Clausen wrote:
> Hello All,
>
> I want to print some integers in a zero padded fashion, eg. :
>
print("Testing %04i" % 1)
> Testing 0001
>
> but the padding needs to be dynamic eg. sometimes %05i, %02i or some
> other padding amount. But I can't inser
On Wed, Jun 8, 2011 at 12:06 PM, Pony wrote:
> Hi all,
>
> I'm a newbie with python, and I have a question about running parallel
> C++ binaries with python.
>
> Suppose I have a C++ binary named "test" and it takes two inputs, if I
> want to run below three commands in bash:
> test a b
> test c d
On Thu, Jun 9, 2011 at 1:31 AM, Ganapathy Subramanium
wrote:
> Hi Guru's,
> I'm working on a solution to find the prime factor of the number
> This part of the code works.. http://www.pastie.org/2041584
For the archives, that code is:
num = 13195
#num = 600851475143L
prime_numbers = [2]
prime_fa
On Thu, Jun 16, 2011 at 3:11 PM, Gnarlodious wrote:
> Is there any way to call a Py script from Javascript in a webpage?
Where is the script located, and where do you want it to run? Server or client?
> I don't have to tell you how messy JS is…
Indeed. jQuery dulls the pain though.
Cheers,
Chr
On Sat, Jun 18, 2011 at 4:21 PM, Cathy James wrote:
> Subject: NEED HELP-process words in a text file
>
> Dear Python Experts,
>
> First, I'd like to convey my appreciation to you all for your support
> and contributions. I am a Python newborn and need help with my
> function. I commented on my p
On Sat, Jun 18, 2011 at 4:21 PM, Cathy James wrote:
> Dear Python Experts,
>
> First, I'd like to convey my appreciation to you all for your support
> and contributions. I am a Python newborn and need help with my
> function. I commented on my program as to what it should do, but
> nothing is pri
On Sat, Jun 18, 2011 at 9:57 PM, Cathy James wrote:
> I managed to get output for my function, thanks much for your
> direction. I really appreciate the hints. Now I have tried to place
> the statement "print ("Length \t" + "Count\n")" in different places in
> my code so that the function can pri
On Sun, Jun 19, 2011 at 11:00 PM, Tim Hanson wrote:
> Using linux and Python 2.6, learning how to work with files from a Windows
> oriented textbook:
>
> This works:
> infile=open('/foo/bar/prog/py_modules/this_is_a_test','r')
>
> This doesn't:
> infile=open('~/prog/py_modules/this_is_a_test','r')
On Mon, Jun 20, 2011 at 6:42 PM, Spencer Pearson
wrote:
> I was recently trying to implement a dict-like object which would do
> some fancy stuff when it was modified, and found that overriding the
> __setitem__ method of an instance did not act the way I expected. The
> help documentation (from h
On Tue, Jun 21, 2011 at 1:51 PM, Guillaume Martel-Genest
wrote:
> What is the pythonic way to handle imports error? What is bugging me
> is that the imports can't be inside a function (because I use them in
> different places in the script and thus they have to be in the global
> scope). I would w
On Wed, Jun 22, 2011 at 8:54 AM, Adam Chapman
wrote:
> I've added the python directories to the environment variable "path"
> in my computer (http://showmedo.com/videotutorials/video?
> name=96&fromSeriesID=96), which means I can now call python from
> the windows DOS-style command prompt.
>
On Wed, Jun 22, 2011 at 11:50 PM, kkiranmca wrote:
> Hi i am new for this version and could please help me .
You didn't pose an actual question...
Cheers,
Chris
--
http://mail.python.org/mailman/listinfo/python-list
On Mon, Jun 27, 2011 at 11:47 PM, Andrew Berg wrote:
> On 2011.06.28 01:32 AM, Peter Otten wrote:
>> >>> subprocess.call(["ls"], stdout=open(os.devnull, "w"))
>> 0
> D'oh! Not sure why I was thinking os.devnull was a file object. :-[
On the bright side, I think in part due to this /exact/
misunde
On Tue, Jun 28, 2011 at 12:17 PM, Amaninder Singh wrote:
> Hi Guys,
> I am fairly new to the language and programing. I am trying to solve a
> problem in a text file. Where names are something like in this manner
> [**Name2 (NI) 98**]
>
> [**Last Name (STitle) 97**]
> [**First Name4 (NamePattern
On Thu, Jun 30, 2011 at 12:02 AM, Thomas Guettler wrote:
> On 30.06.2011 03:24, Thomas 'PointedEars' Lahn wrote:
>> Andrew Berg wrote:
>> Therefore, however, I can tell you that the mailing list to Usenet gateway
>> is seriously borked, as missing References header fields are not generated
>> by
On Fri, Jul 1, 2011 at 12:03 AM, Даниил Рыжков wrote:
> Hello, everyone!
>
> How can I get headers with urlretrieve? I want to send request and get
> headers with necessary information before I execute urlretrieve(). Or
> are there any alternatives for urlretrieve()?
You can use regular urlopen()
On Fri, Jul 1, 2011 at 1:02 AM, Andrew Berg wrote:
> On 2011.07.01 02:26 AM, Peter Otten wrote:
>> I can't reproduce your setup, but I'd try using communicate() instead of
>> wait() and close().
> I don't really know what communicate() does.
"Read data from stdout and stderr, until end-of-file is
On Fri, Jul 1, 2011 at 1:53 AM, Даниил Рыжков wrote:
> Hello again!
> Another question: urlopen() reads full file's content, but how can I
> get page by small parts?
I don't think that's true. Just pass .read() the number of bytes you
want to read, just as you would with an actual file object.
C
On Sat, Jul 2, 2011 at 2:59 PM, Saqib Ali wrote:
> Then I instantiate 2 instances of myClass2 (c & d). I then change the
> value of c.mySet. Bizarrely changing the value of c.mySet also affects
> the value of d.mySet which I haven't touched at all!?!?! Can someone
> explain this very strange beha
On Sat, Jul 2, 2011 at 3:23 PM, Saqib Ali wrote:
>> Instance variables are properly created in the __init__()
>> initializer method, *not* directly in the class body.
>>
>> Your class would be correctly rewritten as:
>>
>> class MyClass2(object):
>> def __init__(self):
>> self.mySet =
On Sat, Jul 2, 2011 at 5:46 PM, Chris Angelico wrote:
> On Sun, Jul 3, 2011 at 8:23 AM, Saqib Ali wrote:
>> So just out of curiosity, why does it work as I had expected when the
>> member contains an integer, but not when the member contains a set?
>
> It's not integer vs set; it's the difference
On Sat, Jul 2, 2011 at 6:21 PM, Dustin Cheung wrote:
> Hey guys,
> I am new to python. I want to make a shortcut that opens my websites
> and re-sizes them to display on different areas on the screen. I looked
> around but i had no luck. Is that possible with python? if so can someone
> point to
> On Sat, Jul 2, 2011 at 7:10 PM, Chris Rebert wrote:
>> On Sat, Jul 2, 2011 at 6:21 PM, Dustin Cheung wrote:
>> > Hey guys,
>> > I am new to python. I want to make a shortcut that opens my websites
>> > and re-sizes them to
>> > point to to the ri
On Mon, Jul 4, 2011 at 12:53 PM, MRAB wrote:
> On 04/07/2011 20:41, Amaury Forgeot d'Arc wrote:
>>> Le lundi 04 juillet 2011 à 10:52 -0700, Gregory P. Smith a écrit :
note that a fast lookup implies exact type and not subclass making my
point silly... at which point you're back to i
On Mon, Jul 4, 2011 at 11:11 AM, Tim Johnson wrote:
> Using Python 2.6 on ubuntu 10.04.
> inspect module :
> I want to 'inspect' a module and get a list of all
> functions, classes and global variables in that module.
You meant "first defined in" that module.
> Example, for a module name `mvcInst
On Tue, Jul 5, 2011 at 10:54 PM, Phlip wrote:
> Pythonistas:
>
> Consider this hashing code:
>
> import hashlib
> file = open(path)
> m = hashlib.md5()
> m.update(file.read())
> digest = m.hexdigest()
> file.close()
>
> If the file were huge, the file.read() would allocate a big string and
>
On Thu, Jul 7, 2011 at 7:18 AM, Grant Edwards wrote:
> On 2011-07-06, Waldek M. wrote:
>> Dnia Wed, 06 Jul 2011 03:36:24 +1000, Steven D'Aprano napisa?(a):
>
>>> Because unless you are extremely disciplined, code and the comments
>>> describing them get out of sync. [...]
>
>> True, but that gets
On Sun, Jul 10, 2011 at 5:00 PM, Tim Johnson wrote:
> * Carl Banks [110710 15:18]:
>> On Sunday, July 10, 2011 3:50:18 PM UTC-7, Tim Johnson wrote:
>> > ## Is it possible to get the module docstring
>> > ## from the module itself?
>>
>> print __doc__
> Thanks Carl.
>
> Where is general docum
On Sun, Jul 10, 2011 at 4:06 PM, Corey Richardson wrote:
> Excerpts from Carl Banks's message of Sun Jul 10 18:59:02 -0400 2011:
>> print __doc__
>>
>
> Python 2.7.1 (r271:86832, Jul 8 2011, 22:48:46)
> [GCC 4.4.5] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
On Mon, Jul 11, 2011 at 10:39 PM, David wrote:
> Should the following line work for defining a matrix with zeros?
>
> c= [[0]*col]*row
>
> where "col" is the number of columns in the matrix and "row" is of
> course the number of rows.
Nope. See the FAQ:
http://docs.python.org/faq/programming.html
On Wed, Jul 13, 2011 at 6:42 AM, Vlad Didenko wrote:
> Colleagues,
> Per documentation
> at http://docs.python.org/py3k/library/sys.html#sys.tracebacklimit :
> When [sys.tracebacklimit] set to 0 or less, all traceback information
> is suppressed and only the exception type and value are print
On Wed, Jul 13, 2011 at 5:18 PM, think wrote:
> when i type import image in the python interactive command, i am surprised
> to find that it does not work. the details are as follows:
What led you to expect that exact command would work in the first place??
import image
> Traceback (most re
On Fri, Jul 15, 2011 at 7:47 PM, Steven D'Aprano
wrote:
> Assertions are for testing internal program logic, not for validation.
>
> (I don't even like using assert for testing. How do you test your code with
> assertions turned off if you use assert for testing?)
I would think that would only m
On Tue, Jul 19, 2011 at 7:20 AM, J wrote:
> Hi guys,
>
> Thank you for your suggestions. I have managed to get my whole script to
> execute in under 10 seconds by changing the 'for loop' I posted above to the
> following:-
>
> for opco in Cn:
> for service in Cn[opco]:
> a
On Tue, Jul 19, 2011 at 8:17 PM, CM wrote:
> I have three items in a dict, like this:
>
> the_dict = {'a':1, 'b':2, 'c':3}
>
> but the vals could be anything. I want to configure something else
> based on the "winner" of such a dict, with these rules:
>
> 1. In this dict, if there is a UNIQUE max
On Tue, Jul 19, 2011 at 10:10 PM, CM wrote:
> On Jul 19, 11:17 pm, CM wrote:
>> I have three items in a dict, like this:
>>
>> the_dict = {'a':1, 'b':2, 'c':3}
>>
>> but the vals could be anything. I want to configure something else
>> based on the "winner" of such a dict, with these rules:
> I
On Fri, Jul 22, 2011 at 12:13 PM, John Gordon wrote:
> In <98u00kfnf...@mid.individual.net> Neil Cerutti writes:
>
>> You can fit much more code per unit of horizontal space with a
>> proportionally spaced font. As a result, that issue, while valid,
>> is significantly reduced.
>
> Is it? I assu
On Mon, Jul 25, 2011 at 12:19 PM, RVince wrote:
> I am instantiating an SSH client class using this class:
>
> http://www.goldb.org/sshpython.html
You might consider using Paramiko instead:
http://www.lag.net/paramiko/
Cheers,
Chris
--
http://mail.python.org/mailman/listinfo/python-list
On Thu, Jul 28, 2011 at 2:11 AM, Peter Irbizon wrote:
> Hello guys,
>
> I would like to translate all strings in my application for several
> languages (eng, es, de, etc) and user should be able to switch app
> from one language to another. I am still newbie with python so is
> there any "step-by-
On Thu, Jul 28, 2011 at 6:20 PM, Peter Irbizon wrote:
> hello,
> I am using gettext fo localization
> Now I would like to switch all texts in my app when I click on item in menu.
> Unfortunatelly this not switch texts immediately. How can I do this?
Which GUI toolkit are you using?
Cheers,
Chri
On Sun, Jul 31, 2011 at 11:36 AM, Andrew Berg wrote:
> On 2011.07.31 02:41 AM, Thorsten Kampe wrote:
>> Another approach would be named tuples instead of dictionaries or flat
>> SQL tables.
> What would the advantage of that be?
Less punctuation noise:
QueueItem.x264.avs.filter.fft3d.ffte
vs.
Qu
On Sun, Jul 31, 2011 at 9:56 PM, Ghodmode wrote:
> I've noticed that python-list gets significantly more spam than the
> other lists I subscribe to. There's an example below.
>
> I'm wondering how the list is managed. Can anyone post, or only
> members?
Since we're gatewayed to USENET's comp.la
On Mon, Aug 1, 2011 at 8:22 PM, Tony Zhang wrote:
> Thanks!
>
> Actually, I used .readline() to parse file line by line, because I need
> to find out the start position to extract data into list, and the end
> point to pause extracting, then repeat until the end of file.
> My file to read is forma
On Tue, Aug 2, 2011 at 9:20 AM, smith jack wrote:
> if it's for a single character, this should be very easy, such as
> c{m,n} the occurrence of c is between m and n,
>
> if i want to define the occurrence of (.*?) how should make it
> done? ((.*?)){1,3} seems not work, any method to define r
On Tue, Aug 2, 2011 at 7:19 AM, Neal Becker wrote:
> I thought this was an interesting article
>
> http://www.pipeline.com/~hbaker1/Use1Var.html
See also:
http://en.wikipedia.org/wiki/Uniqueness_type
Cheers,
Chris
--
http://mail.python.org/mailman/listinfo/python-list
On Tue, Aug 2, 2011 at 9:55 AM, Chris Angelico wrote:
> As I understand it, Python exclusively late-binds names; when you
> define a function, nothing is ever pre-bound. This allows a huge
> amount of flexibility (letting you "reach into" someone else's
> function and change its behaviour), but it
On Tue, Aug 2, 2011 at 11:02 AM, smith jack wrote:
> the source code is as follows
>
> x={}
> x['a'] = 11
> x['c'] = 19
> x['b'] = 13
> print x
>
> tmp = sorted(x.items(), key = lambda x:x[0]) # increase order by
> default, if i want to have a descending order, what should i do?
Pass reverse=
On Wed, Aug 3, 2011 at 8:29 AM, Phlip wrote:
> Groupies:
>
> This is either a code snippet, if you like it, or a request for a
> critique, if you don't.
>
> I want to call a command and then treat the communication with that
> command as an object. And I want to do it as application-specifically
>
On Wed, Aug 3, 2011 at 9:06 PM, Danny Wong (dannwong)
wrote:
> Hi all,
>
> I have 5 server machines that are using to process
> information. I would like to write a quick server python script that
> determines which of the machines are not in use. Any recommendations on
> which pyt
On Wed, Aug 3, 2011 at 9:25 PM, Christian Gelinek
wrote:
> Hi all,
>
> I have a problem running some python program using version 2.6.4 (or version
> 2.7.2, I tried both) from the Win7 command line - it never finishes due to
> an infinite loop. The thing is, when I run the same program through Cyg
On Thu, Aug 4, 2011 at 1:10 AM, Thomas Rachel
wrote:
> Am 03.08.2011 19:27 schrieb Chris Rebert:
>
>>> shell= True,
>>
>> I would strongly encourage you to avoid shell=True.
>
> ACK, but not because it is hard, but because it is unnecess
On Thu, Aug 4, 2011 at 5:43 AM, Billy Mays
<81282ed9a88799d21e77957df2d84bd6514d9...@myhashismyemail.com> wrote:
> Hey c.l.p.,
>
> I wrote a little python script that finds the file that a python module came
> from. Does anyone see anything wrong with this script?
>
>
> #!/usr/bin/python
>
> impor
On Thu, Aug 4, 2011 at 8:25 PM, John Riselvato wrote:
> I am working on a license verification script. I am rather new to the
> concept and to JSON files in general.
Based on your questions, reading a programming tutorial might be a
good idea. Here's one that uses Python and that I've heard prais
On Fri, Aug 5, 2011 at 11:52 AM, gervaz wrote:
> Hi all, is there a way to retrive the function name like with
> self.__class__.__name__?
>
> Using self.__dict__.__name__ I've got
>
def test():
> ... print(self.__dict__.__name__)
> ...
Er, where did `self` magically come from?
test
On Fri, Aug 5, 2011 at 11:07 AM, Geoff Wright wrote:
> Hi,
>
> I use Mac OSX for development but deploy on a Linux server. (Platform
> details provided below).
>
> When the locale is set to FR_CA, I am not able to display a u circumflex
> consistently across the two machines even though the def
> On Fri, Aug 5, 2011 at 2:19 AM, Chris Rebert wrote:
>> On Thu, Aug 4, 2011 at 8:25 PM, John Riselvato
>> wrote:
>> > I am working on a license verification script. I am rather new to the
>> > concept and to JSON files in general.
>>
On Fri, Aug 5, 2011 at 10:49 PM, Devraj wrote:
> Hi all,
>
> I am trying to simply my Web application handlers, by using Python
> decorators.
>
> Essentially I want to use decorators to abstract code that checks for
> authenticated sessions and the other that checks to see if the cache
> provider
On Sat, Aug 6, 2011 at 12:34 AM, Eli Bendersky wrote:
> Consider this standard metaclass definition:
>
> class MyMetaclass(type):
> def __init__(cls, name, bases, dct):
> super(MyMetaclass, cls).__init__(name, bases, dct)
> # do meta-stuff
>
> class Foo(object):
> __metaclass__
On Tue, Aug 9, 2011 at 9:42 PM, Yingjie Lan wrote:
> Hi all,
>
> When writing a long expresion, one usually would like to break it into
> multiple lines. Currently, you may use a '\' to do so, but it looks a little
> awkward (more like machine-oriented thing). Therefore I start wondering why
>
On Tue, Aug 9, 2011 at 11:38 PM, Danny Wong (dannwong)
wrote:
> Hi All,
> I'm trying to execute some external commands from multiple database.
> I'm using threads and subprocess.Popen ( from docs, all the popen*
> functions are deprecated and I was told to use subprocess.Popen) to
> execute the
> On Tue, Aug 9, 2011 at 11:38 PM, Danny Wong (dannwong)
> wrote:
>> Hi All,
>> I'm trying to execute some external commands from multiple database.
>> I'm using threads and subprocess.Popen ( from docs, all the popen*
>> functions are deprecated and I was told to use subprocess.Popen) to
>> exe
> From: Chris Rebert
>> On Tue, Aug 9, 2011 at 11:38 PM, Danny Wong (dannwong)
>> wrote:
>>> Hi All,
>>> I'm trying to execute some external commands from multiple database.
>>> I'm using threads and subprocess.Popen ( from docs, all the p
On Wed, Aug 10, 2011 at 7:56 PM, Steven D'Aprano
wrote:
> On Thu, 11 Aug 2011 11:24 am Jim wrote:
>
>> Greetings, folks,
>>
>> I am using python 2.7.2. Here is something I got:
> a = 'popular'
> i = a.find('o')
> j = a.find('a')
> a[i:j]
>> 'opul'
>>
>> Well, I expected a[i:j] to b
On Wed, Aug 10, 2011 at 7:52 PM, Yingjie Lan wrote:
> :And if we require {} then truly free indentation should be OK too! But
>
> :it wouldn't be Python any more.
>
> Of course, but not the case with ';'. Currently ';' is optional in Python,
I think of it more as that Python deigns to permit semi
> On Aug 10, 2011 10:57 PM, "Yingjie Lan" wrote:
>> :And if we require {} then truly free indentation should be OK too! But
>>
>> :it wouldn't be Python any more.
>>
>> Of course, but not the case with ';'. Currently ';' is optional in Python,
>> But '{' is used for dicts. Clearly, ';' and '{' are
On Thu, Aug 11, 2011 at 12:24 AM, Yingjie Lan wrote:
> From: Steven D'Aprano
> On Thu, 11 Aug 2011 12:52 pm Yingjie Lan wrote:
>
>> :And if we require {} then truly free indentation should be OK too! But
>>
>> :it wouldn't be Python any more.
>>
>> Of course, but not the case with ';'. Currently
On Fri, Aug 12, 2011 at 3:39 AM, Ben Finney wrote:
> Seebs writes:
>
>> Question for y'all:
>>
>> Has anyone here ever ACTUALLY encountered a case where braces -- not
>> indentation -- did not match intent in a C-like language? I'm talking
>> only about cases where braces are *actually present*.
On Sat, Aug 13, 2011 at 12:14 PM, MrPink wrote:
> Is this the correct way to convert a String into a Date?
> I only have dates and no time.
>
> import time, datetime
>
> oDate = time.strptime('07/27/2011', '%m/%d/%Y')
> print oDate
from datetime import datetime
the_date = datetime.strptime('07/27
On Sun, Aug 14, 2011 at 1:34 AM, Chris Angelico wrote:
> Yes. Not everything's an expression; a block of code is not an
> expression that returns a code object, and variable assignment is a
> statement. Some day, I'd like to play around with a language where
> everything's an expression and yet i
2011/8/14 守株待兔 <1248283...@qq.com>:
> please to see my code:
> import urllib
> import urllib2
>
> url = 'http://hi.baidu.com/'
> values = {'username' : '**','password' : '**' }
>
> data = urllib.urlencode(values)
> req = urllib2.Request(url,data)
> response = urllib2.urlopen(req)
> the_page
On Sun, Aug 14, 2011 at 3:56 PM, Jason Hsu wrote:
> I have a script that I execute as root, but I need to change the
> ownership of the files created in the script to that of my username.
> In GNU Bash, the command is something like "chown myusername:users".
> What's the equivalent Python command?
On Sun, Aug 14, 2011 at 6:54 PM, Steven D'Aprano
wrote:
> Seebs wrote:
>> Interesting! I tend to really like the ability to chain methods,
>> depending
>> on context. I find the side-effect/expression mix pretty normal, so I'm
>> used to it.
>
> As a rule, chaining method calls risks violating
On Tue, Aug 16, 2011 at 12:03 AM, Danny Wong (dannwong)
wrote:
> Hi All,
> I'm executing a command which I want to capture the
> standard/stderr output into a file (which I have with the code below),
> but I also want the standard output to go into a variable so I can
> process the informat
On Tue, Aug 16, 2011 at 12:00 AM, Danny Wong (dannwong)
wrote:
> Hi All,
> If I get multiline standard output from a command. How can I
> retrieve this part of the string "(1006)"
> Example:
>
> #Committing...
> #Workspace: (1003) "My OS_8.12.0 Work" <-> (1004) "OS_8.12.0"
> # Component: (
On Tue, Aug 16, 2011 at 12:45 AM, smain kahlouch wrote:
> Hi all,
>
> I'm learning the python language and i'm trying to create a user if it is
> not found in the system.
> I figured it out by doing the following thing :
>
def finduser(user):
> ... for line in open('/etc/passwd'):
> ...
On Wed, Aug 17, 2011 at 2:19 AM, Gnarlodious wrote:
> I should add that this does what I want, but something a little more
> Pythonic?
>
> import cgi, os
> os.environ["QUERY_STRING"] = "name1=Val1&name2=Val2&name3=Val3"
> form=cgi.FieldStorage()
>
> form
>
> dict = {}
> for key in form.keys(): dic
On Fri, Aug 19, 2011 at 6:00 AM, Johan Ekh wrote:
> Hi all,
> I have a script "myscript.py" located in "/usr/local/bin" on my linux box.
> I can execute it in ipython with
>
> run /usr/local/bin/myscript.py
>
> but not with
>
> run myscript.py
>
> even though /usr/local/bin is in my $PATH and in m
On Fri, Aug 19, 2011 at 8:08 AM, Yingjie Lin wrote:
> Hi Python users,
>
> I am maintaining a website written with Python CGI scripts. To make sure the
> website is working well,
> I would like to have a script which automatically "uses" this website and
> checks it's output everyday. It
> would
On Fri, Aug 19, 2011 at 1:02 PM, johnny.venter wrote:
>
> Hello, I am looking for the Python Windows Extensions to see if they can be
> installed on a Mac.THanks.
Your request is nonsensical. pywin32 wraps the Windows API libraries.
Mac OS X is not Windows; it does not implement the Windows API.
On Sat, Aug 20, 2011 at 1:25 AM, Jurgens de Bruin wrote:
> Hi,
>
> I have a list of tuples:
>
> [(2,),(12,13),(2,3,4),(8,),(5,6),(7,8,9),]
>
> I would like to compare all the tuples to each other and if one
> element if found two tuples the smallest tuples is removed from the
> list.
So, would [(
On Sun, Aug 21, 2011 at 10:27 AM, Max wrote:
> On Aug 20, 1:40 pm, Steven D'Aprano +comp.lang.pyt...@pearwood.info> wrote:
>> On Sat, Aug 20, 2011 at 7:20 PM, Max Moroz wrote:
>> > Would it be a good idea to change Python definition so that a[10, -1, -1]
>>
>> I presume you mean slice notation a
On Mon, Aug 22, 2011 at 5:17 PM, Yingjie Lin wrote:
> Hi Python users,
>
> I have a question about the instance of closeable_response in module
> Mechanize.
>
> from mechanize import ParseResponse, urlopen
> url = "http://wwwsearch.sourceforge.net/mechanize/example.html";
> r
2011/8/22 守株待兔 <1248283...@qq.com>:
> from Tkinter import *
> fields = 'Name', 'Job', 'Pay'
>
> def fetch(event,entries):
> for entry in entries:
> print 'Input => "%s"' % entry.get() # get text
> print event.widget
>
>
> def makeform(root, fields):
> entries = []
> fo
On Tue, Aug 23, 2011 at 9:29 AM, Roy Smith wrote:
> I want to log a string but only the first bunch of it, and add "..."
> to the end if it got truncated. This certainly works:
>
> log_message = message
> if len(log_message) >= 50:
> log_message = log_message[:50] + '
On Tue, Aug 23, 2011 at 9:05 PM, Dave Angel wrote:
> On 01/-10/-28163 02:59 PM, Adrián Monkas wrote:
>> print "Abro Archivo Origen"
>> archivo=open("D:\Boot.txt","r")
> Your filenames are incorrect, since you use the backslash without escaping
> it. So the source file ha
On Tue, Aug 23, 2011 at 11:29 PM, Muresan Alexandru Mihai
wrote:
> If you need an int isn't better to use input() instead of raw_input() ?
Absolutely not! input() does an eval(), which is very dangerous
security-wise and can also lead to rather strange behavior.
input() is so bad that it was remo
On Thu, Aug 25, 2011 at 1:25 AM, Tracubik wrote:
> Hi all!
> i'ld like to execute via Python this simple bash command:
>
> sudo las
>
> las is intended to be a typo for "ls"
>
> the point is that i want to see in the terminal the stderr message (that
> is "sorry, try again" if i insert the wrong p
On Thu, Aug 25, 2011 at 11:43 AM, Emory Watts wrote:
> Hello, I tried to find out how to do this on my own, but searching around
> turned up no results. And this is the only way I saw to get a question
> answered. I would like know how to disable the pop up predictions menu that
> appears when I p
On Thu, Aug 25, 2011 at 1:38 PM, noydb wrote:
> Hello All,
>
> Looking for some advice/ideas on how to implement a ranking to a
> 'scores' field I have. So this scores field has values ranging from
> 1.00-4. There is also a count field. I want to add a rank field such
> that all the records hav
On Fri, Aug 26, 2011 at 12:56 AM, Tracubik wrote:
> Il Thu, 25 Aug 2011 01:52:25 -0700, Chris Rebert ha scritto:
>> On Thu, Aug 25, 2011 at 1:25 AM, Tracubik wrote:
>>> Hi all!
>
> cut
>
>> Untested:
>>
>> from subprocess import Popen, PIPE sudo =
On Sat, Aug 27, 2011 at 6:42 AM, Jason Swails wrote:
> Hello everyone,
>
> This is probably a basic question with an obvious answer, but I don't quite
> get why the type(foo).__name__ works differently for some class instances
> and not for others. If I have an "underived" class, any instance of
On Sun, Aug 28, 2011 at 5:35 PM, Gee Chen wrote:
> --
> the Python environment on my mac is:
>
> Python 2.6.4 (r264:75706, Aug 28 2011, 22:29:24)
> [GCC 4.2.1 (Apple Inc. build 5664)] on darwin
For future reference, when on OS X, it's very helpful to include how
yo
On Sun, Aug 28, 2011 at 2:20 PM, Travis Parks wrote:
> I am trying to write an algorithms library in Python. Most of the
> functions will accept functions as parameters. For instance, there is
> a function called any:
>
> def any(source, predicate):
> for item in source:
> if predicate(i
201 - 300 of 2384 matches
Mail list logo