On 02/20/2012 11:55 PM, Michael Lewis wrote:
I am back to being confused. I just tried running the module without first
importing it, and it worked just fine. How do I do this properly to where
the module only runs if I import it?
I'd still like a definition of "just fine." But anyway, your fir
On 2012/02/21 06:55 AM, Michael Lewis wrote:
I am back to being confused. I just tried running the module without
first importing it, and it worked just fine. How do I do this properly
to where the module only runs if I import it?
Code:
def MultiplyText(text, multiplier):
'''Recieve a S &
I am back to being confused. I just tried running the module without first
importing it, and it worked just fine. How do I do this properly to where
the module only runs if I import it?
Code:
def MultiplyText(text, multiplier):
'''Recieve a S & int. For digits in S, multiply by multiplier and
On 02/20/2012 10:07 PM, Michael Lewis wrote:
Now that I am better understanding '__name__'=='__main__', I need to get
advice on one last part. Since you put this in the file as an if statement,
some instruction must come after. What do you suggest putting after this
statement/is that piece of cod
Now that I am better understanding '__name__'=='__main__', I need to get
advice on one last part. Since you put this in the file as an if statement,
some instruction must come after. What do you suggest putting after this
statement/is that piece of code ever put into action?
In my example below, I'
On 02/20/2012 06:46 PM, Michael Lewis wrote:
Hi everyone,
I am having some trouble understanding how to use __name__== '__main__'.
Can you please give me some insight? Also, to use this, it needs to be
within a function? Do you typically just throw it in your very last
function or create a separ
> I am having some trouble understanding how to use __name__== '__main__'. Can
> you please give me some insight?
if __name__ == '__main__': allows you to specify code that will only
be run if you run the actual script it's in; anything in the if block
won't be run if you import the module.
>Also
Thanks. I did end up catching those, but to be fair to all the others, I
did ask that they ignore that issue as I was still working through it on my
own.
On Mon, Feb 20, 2012 at 4:55 PM, bob gailer wrote:
> No one else has caught another problem. I comment on it below:
>
>
> On 2/20/2012 6:46 PM
Does anyone know of a plugin or some other way to run python code in the
scribes text editor in a similar way to Idle which has a debugger?
Thanks,
Tahir
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mai
No one else has caught another problem. I comment on it below:
On 2/20/2012 6:46 PM, Michael Lewis wrote:
Hi everyone,
I am having some trouble understanding how to use __name__==
'__main__'. Can you please give me some insight? Also, to use this, it
needs to be within a function? Do you typi
> On Mon, Feb 20, 2012 at 6:46 PM, Michael Lewis wrote:
> > I at first put it outside and after all my functions but got the error
> below
>
> That's the right place for it, you just spelled it wrong.
>
> > and then put it inside my last function and the program ran.
>
> That's not the right plac
Alan Gauld wrote:
On 20/02/12 21:17, Do Nguyen (donguye) wrote:
command1 = "plink -ssh -pw myPassword myUserName@myServerIP"
p1 = subprocess.Popen(command1)
p2 = subprocess.Popen('ls')
I could verify that command1 was executed successfully, ie. the ssh to
myServer worked, but command2 was trea
On 20/02/12 23:46, Michael Lewis wrote:
I am having some trouble understanding how to use __name__== '__main__'.
Can you please give me some insight?
Others have told you how to fix it. The insight is that when
you import a python file its __name__ attribute is set to the module
name. When yo
On 20/02/12 23:46, Michael Lewis wrote:
it inside my last function and the program ran. (side note, I have an
error in my return for MultiplyText that I am still trying to work out,
You can remove the outer for loop, you are already looping over text
inside the generator expression.
HTH,
--
On 20/02/12 21:17, Do Nguyen (donguye) wrote:
command1 = "plink -ssh -pw myPassword myUserName@myServerIP"
p1 = subprocess.Popen(command1)
p2 = subprocess.Popen('ls')
I could verify that command1 was executed successfully, ie. the ssh to
myServer worked, but command2 was treated locally in the
Michael Lewis wrote:
Error I got when __name == ' __main__' was outside of any function:
Traceback (most recent call last):
File "C:/Python27/Homework/Homework5_1.py", line 24, in
if __name == '__main__':
NameError: name '__name' is not defined
You have misspelled __name__ as __name.
On Mon, Feb 20, 2012 at 6:46 PM, Michael Lewis wrote:
> I at first put it outside and after all my functions but got the error below
That's the right place for it, you just spelled it wrong.
> and then put it inside my last function and the program ran.
That's not the right place for it. Your
Hi everyone,
I am having some trouble understanding how to use __name__== '__main__'.
Can you please give me some insight? Also, to use this, it needs to be
within a function? Do you typically just throw it in your very last
function or create a separate function just for this? I at first put it
o
El 20/02/12 13:42, Dave Angel escribió:
> I'm not sure who you are, but you forgot to include the list.
> Therefore I'll forward this to the list, and add my comments about
> your suggestions.
>
> On 02/20/2012 11:31 AM, Ricardo Araoz wrote:
>> Untested :
>> while True:
>> try:
>> am
> I’m a newbie in python programming …
>
> I wrote the followings to ssh from Windows to a Solaris server:
>
> command1 = "plink -ssh -pw myPassword myUserName@myServerIP"
> p1 = subprocess.Popen(command1)
> p2 = subprocess.Popen('ls')
>
> I could verify that command1 was executed successfull
I'm a newbie in python programming ...
I wrote the followings to ssh from Windows to a Solaris server:
command1 = "plink -ssh -pw myPassword myUserName@myServerIP"
p1 = subprocess.Popen(command1)
p2 = subprocess.Popen('ls')
I could verify that command1 was executed successfully, ie. t
On 20/02/2012 16:43, Sunil Tech wrote:
*I am Beginner (very little i know), i want to know what are new things i
can find in Python.*
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailm
Thanks for your response. Please always reply-all so a copy goes to the
tutor list. I'm cc'ing this to that list.
On 2/19/2012 10:13 AM, Deborah Knoll wrote:
This is for a class - I wasn't trying to hide that fact. I didn't
want someone to write this for me,
I understand and appreciate that.
I think python is great because:
1. it is very easy to read other peoples code and understand it
2. without being cryptic, you can do a lot of logic with very little
typing because the language was well conceived -- it didn't get added
on to in an ad hoc way that (IMO) php has been.
3. there is a
On 20/02/12 16:43, Sunil Tech wrote:
/I am Beginner (very little i know), i want to know what are new things
i can find in Python./
There is a wealth of detail on this on the Python web site.
Try the FAQ for a starter:
http://docs.python.org/faq/general.html
And the success stories for mor
On 02/20/2012 12:16 PM, Darin Lawson Hosking wrote:
Sunil
Here is great way to get started on Python, even though the first few
videos are setting up a Linux virtual machine to develop within, he quickly
moves onto Python.
http://www.youtube.com/user/RaspberryPiTutorials/videos
Darin
The ab
Just to express my opinion on the matter which is cannot stress
enough, Python does not only come with the kitchen sink, it comes with
a very useful kitchen sink, most of the standard library modules are
very useful and not just random additions, I take for example a
comparision against C#, I had t
On 02/20/2012 11:43 AM, Sunil Tech wrote:
*I am Beginner (very little i know), i want to know what are new things i
can find in Python.*
There are thousands of computer languages out there. Nearly every
feature has an analog out there somewhere. So "what's new" really
depends on what lang
*I am Beginner (very little i know), i want to know what are new things i
can find in Python.*
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
I'm not sure who you are, but you forgot to include the list. Therefore
I'll forward this to the list, and add my comments about your suggestions.
On 02/20/2012 11:31 AM, Ricardo Araoz wrote:
El 20/02/12 00:00, Dave Angel escribió:
On 02/19/2012 07:01 PM, Deborah Knoll wrote:
A couple of
30 matches
Mail list logo