easy way to return a list of absolute file or directory path within a directory

2016-09-07 Thread iMath
Any easier solutions on returning a list of absolute file or directory path within a directory? Mine is list(map(lambda entry: os.path.join(directory,entry),os.listdir(directory))) -- https://mail.python.org/mailman/listinfo/python-list

Re: easy way to return a list of absolute file or directory path within a directory

2016-09-07 Thread Steven D'Aprano
On Wednesday 07 September 2016 17:08, iMath wrote: > Any easier solutions on returning a list of absolute file or directory path > within a directory? Mine is > > list(map(lambda entry: os.path.join(directory,entry),os.listdir(directory))) Use a list comprehension: [os.path.join(directory,ent

logging files

2016-09-07 Thread Davala santhosh kumar
how to run psutil.cputimes() program in remote machines using logfiles. -- https://mail.python.org/mailman/listinfo/python-list

Fwd: Fwd: Python freeze fails with warning: the use of `tempnam' is dangerous, better use `mkstemp'

2016-09-07 Thread Alexander N. Moibenko
Hello, when I build a binary with python 2.6 it builds without any problem. When I build with python 2.7 the build fails after warnings like: /opt/python/Python-2.7.12/Modules/posixmodule.o: In function `posix_tempnam': /opt/python/Python-2.7.12/./Modules/posixmodule.c:7578: warning: the use of

How to split value where is comma ?

2016-09-07 Thread Asad ur Rehman
Here is my view.py import os.path import commands def call_report(request): a = commands.getstatusoutput('/usr/local/freeswitch/bin/fs_cli -x "show calls"') return HttpResponse(a) When i run this command it gives output which you can see... 0uuid,direction,created,created_epoch,nam

RE: [Non-DoD Source] Re: Python 3.5.0 python --version command reports 2.5.4

2016-09-07 Thread Yang, Gang CTR (US)
Thanks to all that replied. Indeed I had CollabNet SVN server installed a while back and it came with an older version of Python. Gang Yang Shonborn-Becker Systems Inc. (SBSI) Contractor Engineering Supporting SEC Office: 732-982-8561, x427 Cell: 732-788-7501 Email: gang.yang@mail.mil

Re: How to split value where is comma ?

2016-09-07 Thread Peter Pearson
On Wed, 7 Sep 2016 08:51:36 -0700 (PDT), Asad ur Rehman wrote: [snip] > sofia/external/1203632525,CS_EXECUTE, > Outbound Call, > 12036325259, > ,12036325259, > , > ,ACTIVE, > 9047125683, > 9047125683, > RECV, > 75a9d3ee-7511-11e6-a115-89a1f4981d2c, > vb-pmedia,7841c6c0-7511-11e6

Re: Fwd: Fwd: Python freeze fails with warning: the use of `tempnam' is dangerous, better use `mkstemp'

2016-09-07 Thread Ben Finney
"Alexander N. Moibenko" writes: > /opt/python/Python-2.7.12/./Modules/posixmodule.c:7578: warning: the > use of `tempnam' is dangerous, better use `mkstemp' > collect2: ld returned 1 exit status > > How this can be fixed? The clearest answer is already there in the warning message. Replace your

dictionary total sum

2016-09-07 Thread py
Hello, any ideas why this does not work? def add(key, num): ... a[key] += num ... a={} a["007-12"] = 22 if not a.has_key("007-12") else add("007-12",22) a {'007-12': 22} # OK here, this is what I want a["007-12"] = 22 if not a.has_key("007-12") else add("007-12",22) a {'007-12': None}

Re: dictionary total sum

2016-09-07 Thread Ned Batchelder
On Wednesday, September 7, 2016 at 8:25:42 PM UTC-4, p...@blacktoli.com wrote: > Hello, > > any ideas why this does not work? > > >>> def add(key, num): > ... a[key] += num > ... > >>> a={} > >>> a["007-12"] = 22 if not a.has_key("007-12") else add("007-12",22) > >>> a > {'007-12': 22} # OK h

Re: Does This Scare You?

2016-09-07 Thread Lawrence D’Oliveiro
On Monday, August 22, 2016 at 4:18:39 PM UTC+12, eryk sun wrote: > It would help to consult a reverse-engineered implementation of > RtlGetFullPathName_Ustr and RtlIsDosDeviceName_Ustr. I'll check the > ReactOS source code. This

Re: The Joys Of Data-Driven Programming

2016-09-07 Thread Lawrence D’Oliveiro
On Thursday, August 18, 2016 at 2:36:31 PM UTC+12, I wrote: > Solution: set up a table of rules ... Here is another example. The problem is to list all external file dependencies of a Blender document, to ensure that they exist etc. Cu

Re: How to run a .py file in IPython?

2016-09-07 Thread Lawrence D’Oliveiro
On Wednesday, August 31, 2016 at 3:22:40 AM UTC+12, umair durrani wrote: > It seems that the script can't 'see' any files in the Data directory. Have you tried adding debug statements to the script to 1) print out its default directory, and 2) what items it can see in that directory? -- https://m

Re: Helloworld with Python C extension

2016-09-07 Thread Lawrence D’Oliveiro
On Tuesday, August 30, 2016 at 6:07:15 PM UTC+12, Ganesh Pal wrote: > I was just wondering how could the C extension be debugged ? My usual way of debugging C code is to stick printf statements close to where I think the problem areas might be. Write to stderr, not stdout, so you can redirec

RE: dictionary total sum

2016-09-07 Thread Joaquin Alzola
On Wednesday, September 7, 2016 at 8:25:42 PM UTC-4, p...@blacktoli.com wrote: > Hello, > > any ideas why this does not work? > > >>> def add(key, num): > ... a[key] += num > ... > >>> a={} > >>> a["007-12"] = 22 if not a.has_key("007-12") else add("007-12",22) > >>> a > {'007-12': 22} # OK her

RE: How to split value where is comma ?

2016-09-07 Thread Joaquin Alzola
> where is a comma there should start new line ... How can i do it ? Use the split a.split(",") for x in a: print(x) This email is confidential and may be subject to privilege. If you are not the intended recipient, please do not copy or disclose its content but contact the sender immediately

Re: How to split value where is comma ?

2016-09-07 Thread D'Arcy J.M. Cain
On Wed, 7 Sep 2016 16:04:40 + Joaquin Alzola wrote: > > where is a comma there should start new line ... How can i do it ? > > Use the split > > a.split(",") > for x in a: > print(x) Seems overly complex. print(a.replace(',', '\n')) > This email is confidential and may be subject to pri

Re: Fwd: Fwd: Python freeze fails with warning: the use of `tempnam' is dangerous, better use `mkstemp'

2016-09-07 Thread dieter
"Alexander N. Moibenko" writes: > when I build a binary with python 2.6 it builds without any problem. > When I build with python 2.7 the build fails after warnings like: > /opt/python/Python-2.7.12/Modules/posixmodule.o: In function > `posix_tempnam': > /opt/python/Python-2.7.12/./Modules/posixmo