Hello. I'm using Python 2.7.6 on Mac OSX. I try importing pygame and get this:
>>> import pygame
Traceback (most recent call last):
File "", line 1, in
import pygame
File
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pygame/__init__.py",
line 95, in
By the way, I would recommend not doing this with FTP. If I remember
rightly, it passes passwords in plain text, which is not so good.
Reference: http://en.wikipedia.org/wiki/File_Transfer_Protocol#Security.
You might just want to use something like 'ssh ls' to run ls on the
remote system.
There
On 11/12/13 23:55, Pat Martin wrote:
ftp=FTP(ftpserver)
ftp.login(user=username,passwd=password)
ftp.cwd(remoteworkdir)
listoffiles = ftp.retrlines('NLST')
print listoffiles
ftp.quit()
The output I get is:
sampleone
samplethree
sampletwo
226 Directory send OK.
The list of files I get is just
On 12 December 2013 10:55, Pat Martin wrote:
> Hello,
>
> I am writing a program that needs to pull all of the files from a
> specific directory. I have a few lines written that give me the list
> of files but when I try to assign it to a variable the variable ends
> up equaling "226 Directory sen
On 11/12/13 18:09, uga...@talktalk.net wrote:
No, not really.
mutl(3, 2) has two arguments
rest = mult(a, b - 1) also has two arguments
rest does not have any arguments.
arguments are the values you pass *into* a function.
The function in turn passes back a return value.
In this case rest is
On Wed, Dec 11, 2013 at 03:55:50PM -0800, Pat Martin wrote:
> Hello,
>
> I am writing a program that needs to pull all of the files from a
> specific directory. I have a few lines written that give me the list
> of files but when I try to assign it to a variable the variable ends
> up equaling "22
Hello,
I am writing a program that needs to pull all of the files from a
specific directory. I have a few lines written that give me the list
of files but when I try to assign it to a variable the variable ends
up equaling "226 Directory send Ok", this is a snippet of my code.
ftp=FTP(ftpserver)
No, not really.
mutl(3, 2) has two arguments
rest = mult(a, b - 1) also has two arguments
but it is passed to value as one argument.
value = a + rest
But, thanks anyway.
-A
-Original Message-
From: Mark Lawrence
To: tutor@python.org
Sent: Wed, 11 Dec 2013 17:38
Subject: Re
>
> Yes, because exe-time is not a ate, a point in time, but a time delta (a
> difference), thus does not hold the same attributes. Write out dir() on
> 'now' and on 'exe_time' to get more info. [dir() tells you about what info
> an object knows, and what methods it understands).]
Thanks Denis, t
On 12/11/2013 06:40 PM, Jignesh Sutar wrote:
c = b-a
print "%s days, %.2dh: %.2dm: %.2ds" %
(c.days,c.seconds//3600,(c.seconds//60)%60, c.seconds%60)
This is a correct and general solution. Maybe worth being built-in, in fact, in
my view.
Denis
__
On 12/11/2013 02:55 PM, Jignesh Sutar wrote:
Thanks Mark,
print('%02d:%02d:%04d' % (now.hour, now.minute, now.year))
That works for;
now = datetime.now()
but not for;
exe_time = endTime-startTime
Yes, because exe-time is not a ate, a point in time, but a time delta (a
difference), thus doe
This is a pretty good clarification! (debug prints well designed and well
placed)
Congrats, Mark!
denis
On 12/11/2013 06:37 PM, Mark Lawrence wrote:
On 10/12/2013 14:48, uga...@talktalk.net wrote:
[snipped]
As you're clearly struggling here's my attempt at showing you what is happening.
c:
On 12/11/2013 07:15 PM, Alan Gauld wrote:
Remember we are calling mul() several times, each with a new set of values.
So mul(3,2) calls mul(3,1)
and mul(3,1) calls mul(3,0)
mul(3.0) returns 0 to mul(3,1)
mul(3,1) then returns 3+0 => 3 to mul(3,2)
mul(3,2) returns 3+3 => 6.
This is a very cle
On 12/11/2013 03:56 PM, uga...@talktalk.net wrote:
Self-similar (fractal) recursion, sounds complex, I am guessing this is like
linear recursion but simultaneously in more than one dimension?
Curious business really. Wonders, if I may be a closet programmer, or something,
It is not complex,
On Dec 10, 2013, at 2:28 PM, Reuben wrote:
> Hi,
>
> There exists two Linux machines A and B. Machine B contains python script
> which needs to be run e.g. Test.py
>
> In order to run that script, machine A needs to telnet into machine B and
> then execute "python Test.py"
>
> How can this b
On 11/12/13 12:36, uga...@talktalk.net wrote:
What I do not see is how?
Clearly, a = 3, it is constant throughout each iteration, and
if rest is equal to 3, then a + rest must be equal to 6.
Correct and the return value from the second invocation of mul() is 3.
You spoke of drilling down, a
For reference, you can also see:
http://stackoverflow.com/questions/8906926/formatting-python-timedelta-objects
which shows a similar approach. The accepted solution there uses the
divmod() function to simplify a little bit of the math.
___
Tutor
Thanks folks, I think I have this as a working solution:
import datetime, time
a= datetime.datetime.now()
time.sleep(7.1564651443644)
b= datetime.datetime.now()
#for testing longer time periods
#a= datetime.datetime(2003, 8, 4, 8, 31, 4,0)
#b= datetime.datetime(2004, 8, 5, 19, 32, 6,0)
c = b-a
pri
On 10/12/2013 14:48, uga...@talktalk.net wrote:
[snipped]
As you're clearly struggling here's my attempt at showing you what is
happening.
c:\Users\Mark\MyPython>type mytest.py
level = 0
def mult(a, b):
global level
level += 1
print('level now', level, 'a =', a, 'b =', b)
if
Yes, it does :)
The indents get messed up in my mail programme, but/and
issue running first example, it returns 1:
def sum_up_to(n):
# 'res' for result because 'sum' is a Python builtin symbol
res = 0
for i in range(1, n+1):
res += i
return res
print(sum_up_to(9))
B
It is kind of you to take the trouble of trying to explain.
I see the value assigned to rest on each iteration from the debugging script
that I made,
What I do not see is how?
Clearly, a = 3, it is constant throughout each iteration, and
if rest is equal to 3, then a + rest must be equal to 6.
El 11/12/13 10:37, Mark Lawrence escribió:
On 11/12/2013 13:12, Jignesh Sutar wrote:
print str(exe_time).split('.')[0]
Sorry, I guess my question was why I can't use something similar to
below on exe_time (of type datetime.timedelta)? Rather than doing string
manipulation on decimals or colo
[top posting fixed]
On 11 December 2013 13:37, Mark Lawrence mailto:breamore...@yahoo.co.uk>> wrote:
On 11/12/2013 13:12, Jignesh Sutar wrote:
print str(exe_time).split('.')[0]
Sorry, I guess my question was why I can't use something similar to
below on exe_ti
Thanks Mark,
print('%02d:%02d:%04d' % (now.hour, now.minute, now.year))
That works for;
now = datetime.now()
but not for;
exe_time = endTime-startTime
Thanks,
Jignesh
On 11 December 2013 13:37, Mark Lawrence wrote:
> On 11/12/2013 13:12, Jignesh Sutar wrote:
>
>> print str(exe_time).s
On 11/12/2013 13:12, Jignesh Sutar wrote:
print str(exe_time).split('.')[0]
Sorry, I guess my question was why I can't use something similar to
below on exe_time (of type datetime.timedelta)? Rather than doing string
manipulation on decimals or colons to extract the same.
now = datetime.now(
On 12/11/2013 09:50 AM, Alan Gauld wrote:
Remember that each time mult() is called it creates
its own mini-world of variables independent of the
previous calls.
That, is a key point.
Denis
___
Tutor maillist - Tutor@python.org
To unsubscribe or cha
>
> print str(exe_time).split('.')[0]
Sorry, I guess my question was why I can't use something similar to below
on exe_time (of type datetime.timedelta)? Rather than doing string
manipulation on decimals or colons to extract the same.
now = datetime.now()
print now.hour
print now.minute
print no
On 12/10/2013 03:48 PM, uga...@talktalk.net wrote:
[...]
Recursivity is hard to get really, meaning intuitively with your guts so-to-say.
Maybe using another example may help. Lets us say you want a function that sums
numbers from 1 up to n, the only input variable. (The result should thus be
On Wed, Dec 11, 2013 at 5:55 AM, Jignesh Sutar wrote:
> Hi,
>
> I've googled around extensively to try figure this out assuming it should be
> straight forward (and it probably is) but I'm clearly missing something.
>
> I'm trying to get the total run time of the program but have the final time
>
Hi,
I've googled around extensively to try figure this out assuming it should
be straight forward (and it probably is) but I'm clearly missing something.
I'm trying to get the total run time of the program but have the final time
being displayed in a particular format. I.e. without the seconds in
On 10/12/13 14:48, uga...@talktalk.net wrote:
OK, I'll try again, this time just walking through the code from the top.
def mult(a, b):
if b == 0:
return 0
rest = mult(a, b - 1)
value = a + rest
return value
>
print "3 * 2 = ", mult(3, 2)
We print "3 * 2 = " and
-Original Message-
From: Alan Gauld
To: tutor@python.org
Sent: Wed, 11 Dec 2013 0:29
Subject: Re: [Tutor] recursive function example
On 10/12/13 14:48, uga...@talktalk.net wrote:
>> Here is original code:
>> def mult(a, b):
>> if b == 0:
>> return 0
>>
32 matches
Mail list logo