My code lists the files and directory under a folder and if we want to read
the file it uses the function cat.
But the function cat(get_file) is not working , any suggetions?
Here is my code:
#!/usr/bin/python
import os
import sys
import commands
#import cat
def listdir(s):
try:
file =
On 04/23/2012 12:42 AM, Devin Jeanpierre wrote:
> On Mon, Apr 23, 2012 at 12:34 AM, Steven D'Aprano
> wrote:
>> On Sun, 22 Apr 2012 12:43:36 -0700, John Nagle wrote:
>>
>>> On 4/20/2012 9:34 PM, john.tant...@gmail.com wrote:
On Friday, April 20, 2012 12:34:46 PM UTC-7, Rotwang wrote:
>>>
On Mon, Apr 23, 2012 at 12:42 AM, Devin Jeanpierre
wrote:
> On Mon, Apr 23, 2012 at 12:34 AM, Steven D'Aprano
> wrote:
>> "is" is never ill-defined. "is" always, without exception, returns True
>> if the two operands are the same object, and False if they are not. This
>> is literally the simples
On Mon, Apr 23, 2012 at 12:34 AM, Steven D'Aprano
wrote:
> On Sun, 22 Apr 2012 12:43:36 -0700, John Nagle wrote:
>
>> On 4/20/2012 9:34 PM, john.tant...@gmail.com wrote:
>>> On Friday, April 20, 2012 12:34:46 PM UTC-7, Rotwang wrote:
>>>
I believe it says somewhere in the Python docs that it'
On Sun, Apr 22, 2012 at 9:22 PM, Terry Reedy wrote:
> On 4/22/2012 3:43 PM, John Nagle wrote:
>>
>> On 4/20/2012 9:34 PM, john.tant...@gmail.com wrote:
>>>
>>> On Friday, April 20, 2012 12:34:46 PM UTC-7, Rotwang wrote:
>>>
I believe it says somewhere in the Python docs that it's undefined an
On Sun, 22 Apr 2012 12:43:36 -0700, John Nagle wrote:
> On 4/20/2012 9:34 PM, john.tant...@gmail.com wrote:
>> On Friday, April 20, 2012 12:34:46 PM UTC-7, Rotwang wrote:
>>
>>> I believe it says somewhere in the Python docs that it's undefined and
>>> implementation-dependent whether two identica
On Saturday, April 21, 2012 5:48:29 PM UTC-5, BartC wrote:
> "someone" wrote in message
> news:9533449.630.1335042672358.JavaMail.geo-discussion-forums@ynmf4...
> > On Saturday, April 21, 2012 3:44:49 PM UTC-5, BartC wrote:
>
> > Hi, Bart: Thank you, your post is working now, maybe, I did somethi
On 4/22/2012 3:43 PM, John Nagle wrote:
On 4/20/2012 9:34 PM, john.tant...@gmail.com wrote:
On Friday, April 20, 2012 12:34:46 PM UTC-7, Rotwang wrote:
I believe it says somewhere in the Python docs that it's undefined and
implementation-dependent whether two identical expressions have the sam
On 4/22/2012 3:17 PM, John Roth wrote:
On Sunday, April 22, 2012 1:43:36 PM UTC-6, John Nagle wrote:
On 4/20/2012 9:34 PM, john.tant...@gmail.com wrote:
On Friday, April 20, 2012 12:34:46 PM UTC-7, Rotwang wrote:
I believe it says somewhere in the Python docs that it's
undefined and implement
On Mon, Apr 23, 2012 at 8:13 AM, Kiuhnm
wrote:
> It makes sense though.
> "Import" imports values, not variables.
Python doesn't _have_ variables. Python has names and objects.
http://python.net/~mwh/hacks/objectthink.html
ChrisA
--
http://mail.python.org/mailman/listinfo/python-list
On Sunday, April 22, 2012 1:43:36 PM UTC-6, John Nagle wrote:
> On 4/20/2012 9:34 PM, john.tant...@gmail.com wrote:
> > On Friday, April 20, 2012 12:34:46 PM UTC-7, Rotwang wrote:
> >
> >> I believe it says somewhere in the Python docs that it's undefined and
> >> implementation-dependent whether t
On 4/22/2012 23:08, Kiuhnm wrote:
On 4/22/2012 21:39, mambokn...@gmail.com wrote:
I need to use global var across files/modules:
# file_1.py
a = 0
def funct_1() :
a = 1 # a is global
print(a)
# file_2.py
from file_1 import *
def main() :
funct_1()
a = 2 # a is local, it's not imported
print(a
On 4/22/2012 12:39 PM, mambokn...@gmail.com wrote:
Question:
How can I access to the global 'a' in file_2 without resorting to the whole
name 'file_1.a' ?
Actually, it's better to use the fully qualified name "file_1.a".
Using "import *" brings in everything in the other module, which o
On 04/22/2012 05:08 PM, Kiuhnm wrote:
> On 4/22/2012 21:39, mambokn...@gmail.com wrote:
>> I need to use global var across files/modules:
>>
>> # file_1.py
>> a = 0
>> def funct_1() :
>> a = 1# a is global
>> print(a)
>>
>>
>> # file_2.py
>> from file_1 import *
>> def main() :
>>
On 4/22/2012 21:39, mambokn...@gmail.com wrote:
I need to use global var across files/modules:
# file_1.py
a = 0
def funct_1() :
a = 1 # a is global
print(a)
# file_2.py
from file_1 import *
def main() :
funct_1()
a = 2 # a is local, it's not imported
p
In article
<11146533.5.1335125285850.JavaMail.geo-discussion-forums@pboo1>,
mambokn...@gmail.com wrote:
> On Sunday, April 22, 2012 12:48:23 PM UTC-7, Roy Smith wrote:
>
> > Answer 1: You can't.
> >
> > Answer 2: You might want to look at thread local storage
> > (http://docs.python.org/l
On Mon, Apr 23, 2012 at 6:08 AM, wrote:
> Thanks! Here is what I need to do, perhaps you can give me some hints.
>
> A generic module, used across different independent programs, puts its
> computing results in a var fairly big, ~50KB.
>
> I need the functions in these programs to access that va
On Sunday, April 22, 2012 12:48:23 PM UTC-7, Roy Smith wrote:
> Answer 1: You can't.
>
> Answer 2: You might want to look at thread local storage
> (http://docs.python.org/library/threading.html#threading.local).
>
> Answer 3: Are you sure you really want to do this?
Thanks! Here is what I
On Mon, Apr 23, 2012 at 5:43 AM, John Nagle wrote:
> Operator "is" should be be an error between immutables
> unless one is a built-in constant. ("True" and "False"
> should be made hard constants, like "None". You can't assign
> to None, but you can assign to True, usually with
> unwanted result
In article
<2652842.660.1335123578432.JavaMail.geo-discussion-forums@pbckz3>,
mambokn...@gmail.com wrote:
> I need to use global var across files/modules:
[...]
> Question:
> How can I access to the global 'a' in file_2 without resorting to the whole
> name 'file_1.a' ?
Answer 1: You can't.
A
On 4/20/2012 9:34 PM, john.tant...@gmail.com wrote:
On Friday, April 20, 2012 12:34:46 PM UTC-7, Rotwang wrote:
I believe it says somewhere in the Python docs that it's undefined and
implementation-dependent whether two identical expressions have the same
identity when the result of each is imm
I need to use global var across files/modules:
# file_1.py
a = 0
def funct_1() :
a = 1 # a is global
print(a)
# file_2.py
from file_1 import *
def main() :
funct_1()
a = 2 # a is local, it's not imported
print(a)
Here above 'a' is not imported from file_1
Better yet, write them out as constants if they're referenced more
than once. In that case, if the planet gets knocked into a new orbital
and rotational pattern, you can update accordingly if you,
civilization, and Python all still exist.
~Temia
On Sun, 22 Apr 2012 13:44:15 +0400, you wrote:
>im
On Sun, 22 Apr 2012 17:37:42 +0800
contro opinion wrote:
> i want to know how many days in one year,
> import time
> import datetime
> d1= datetime.datetime(2003, 1, 1)
> d2=datetime.datetime(2003, 21, 31)
ITYM datetime.datetime(2003, 12, 31).
> print (d2-d1).days+1
>
> i can get there are 36
On 4/22/2012 10:29, Bernd Nawothnig wrote:
[...]
In general I always prefer the pure functional approach. But you are
right, if it is too costly, one has to weigh the pros and contras.
Here's some stupid trick I came up with after reading this thread. It's
of very limited use, of course and I
import calendar
print 366 if calendar.isleap(2003) else 365
On 22 April 2012 13:37, contro opinion wrote:
> i want to know how many days in one year,
> import time
> import datetime
> d1= datetime.datetime(2003, 1, 1)
> d2=datetime.datetime(2003, 21, 31)
> print (d2-d1).days+1
>
> i can get t
i want to know how many days in one year,
import time
import datetime
d1= datetime.datetime(2003, 1, 1)
d2=datetime.datetime(2003, 21, 31)
print (d2-d1).days+1
i can get there are 365 days in the 2003,
is there other way,better way to calculate ?
--
http://mail.python.org/mailman/listinfo/pyt
On Sun, Apr 22, 2012 at 2:29 AM, Bernd Nawothnig
wrote:
>> But what about 2), the mixed (impure) functional design? Unfortunately,
>> it too has a failure mode: by returning a list, it encourages the error
>> of assuming the list is a copy rather than the original:
>>
>> mylist = [1, 2, 3, 4]
>> a
On 2012-04-22, Steven D'Aprano wrote:
> On Sat, 21 Apr 2012 14:48:44 +0200, Bernd Nawothnig wrote:
>
>> On 2012-04-20, Rotwang wrote:
>>> since a method doesn't assign the value it returns to the instance on
>>> which it is called; what it does to the instance and what it returns
>>> are two comple
29 matches
Mail list logo