I am facing a very basic problem as any new bie would face.
I know perl and now i want to use python
In perl, it is very simple , just
"perl scriptname.pl"
will execute the script.
But i think python is worse than perl
It takes to interactive mode , which i don;t want to use.
"python scriptname.py"
does not execute python script
It was, i don't know executing it or not.
1. I placed these contents in a file named "1.py"
a,b=0,1
n=5
while n<=0:
print b
a=b
b=a+b
n=n-1
print n
Then
2.
on "cygwin shell in windows"
i gave "python 1.py"
hoping that it will exeucte and give me output, but nothing was
printed
Does python not support teh non-interactive mode of execution
I have the manuals and they dont' specify this thing anywhere. they
tell use "python -c filename"
Please help.
A newbie's request.
Pankaj
i gav 3 2392
"Pankaj" wrote: I know perl and now i want to use python
In perl, it is very simple , just "perl scriptname.pl" will execute the script.
But i think python is worse than perl
It takes to interactive mode , which i don;t want to use.
"python scriptname.py" does not execute python script
It was, i don't know executing it or not.
1. I placed these contents in a file named "1.py" a,b=0,1 n=5 while n<=0: print b a=b b=a+b n=n-1 print n
Then
2. on "cygwin shell in windows" i gave "python 1.py"
hoping that it will exeucte and give me output, but nothing was printed
Does python not support teh non-interactive mode of execution
n=5 while n<=0:
not sure about Perl, but in Python, five is not less than or equal
to zero.
maybe you meant to write:
n=5
while n >= 0:
?
</F>
Pankaj enlightened us with: But i think python is worse than perl
No it isn't.
It takes to interactive mode , which i don;t want to use.
Then don't use it.
"python scriptname.py" does not execute python script
Yes it does.
1. I placed these contents in a file named "1.py" a,b=0,1 n=5 while n<=0:
Which is immediately false.
on "cygwin shell in windows" i gave "python 1.py"
hoping that it will exeucte and give me output, but nothing was printed
Which is correct for your program.
Sybren
--
The problem with the world is stupidity. Not saying there should be a
capital punishment for stupidity, but why don't we just take the
safety labels off of everything and let the problem solve itself?
Frank Zappa This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Andrew Chalk |
last post by:
Is this possible? In my CGI app. I display a web page with a link (anchor).
When the link is clicked I want to exectute a python script rather than go
to an HTML page.
Many thanks.
|
by: SS |
last post by:
I am trying to execute some python commands within a perl script and
running into problems. The following works:
python -c "import mypkg;do this; do that"
however when I try to do something like...
|
by: Olivier Scalbert |
last post by:
Hello ,
What is the python way of doing this :
perl -pi -e 's/string1/string2/' file
?
Thanks
Olivier
|
by: sarmin kho |
last post by:
Hi Python Guru,
I ve created a GUI using Boa constructor and am now trying to execute a python script when pressing a button on the GUI. So, there will then be two main threads running (the GUI...
|
by: Darren Dale |
last post by:
Is there a place to put python programs so I dont have to refer to the
absolute path everytime I want to call them? For example:
if I am in /home/me and want to execute:
python...
|
by: Valentina Boycheva |
last post by:
Thanks for the reply. I already have "Learning Python" from Mark Lutz and
David Ascher, which covers 2.3 (I am in 2.4). However, it seems like heavy
artillery to me. What I want is, for instance,...
|
by: Ian Warford |
last post by:
Hi,
I have a problem with a PL/PerlU function trying to execute an external
perl script.
The script is suid to a non-root user and I am executing it in the
PL/PerlU function as so :
$rc =...
|
by: olaufr |
last post by:
Hi,
I need to call a python script, with command line arguments (it is an
autonomous script with a __main__), from within another python script.
Can I use exec() or execfile() for this? How to...
|
by: Andrew Ayre |
last post by:
Hi, I have a script that I want to execute from C. I don't want to call any
functions, just execute the script. Below is a code snippet.
The problem is that PyObject_CallObject always returns...
|
by: gaurav kashyap |
last post by:
HI all,
i have two python programs as 1.py and 2.py
1.py
import os
import sys
processID=os.spawnl(os.P_WAIT,'/usr/local/bin/python','python','/
mywork/2.py ' + 'hi')
2.py
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |