[Tutor] Error in executing 'Python Filename.py'.

2011-05-19 Thread Neha P
C:\>python hello.py

'python' is not recognized as an internal or external command,
operable program or batch file.

C:\>cd python26

C:\Python26>python
Python 2.6.4 (r264:75708, Oct 26 2009, 08:23:19) [MSC v.1500 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> python hello.py
  File "", line 1
    python hello.py
               ^
SyntaxError: invalid syntax
>>> python
Traceback (most recent call last):
  File "", line 1, in 
NameError: name 'python' is not defined
>>>

Above is the snapshot of the error.
M running Windows 7 Home Premium, OS: NT
Have  ;C:\Python26 added to the PATH variable , still unable to execute any 
file :( same error.

Please help!! Thanks in advance..___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Error in executing 'Python Filename.py'.

2011-05-19 Thread Neha P
Hey all, got the solution...
Thanks for the help :) :)
Just needed to from 
C:\Python26>Python hello.py
Its working fine...



From: Neha P 
To: "tutor@python.org" 
Sent: Thursday, May 19, 2011 4:14 PM
Subject: [Tutor] Error in executing 'Python Filename.py'.


C:\>python hello.py

'python' is not recognized as an internal or external command,
operable program or batch file.

C:\>cd python26

C:\Python26>python
Python 2.6.4 (r264:75708, Oct 26 2009, 08:23:19) [MSC v.1500 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> python hello.py
  File "", line 1
    python hello.py
               ^
SyntaxError: invalid syntax
>>> python
Traceback (most recent call last):
  File "", line 1, in 
NameError: name 'python' is not defined
>>>

Above is the snapshot of the error.
M running Windows 7 Home Premium, OS: NT
Have  ;C:\Python26 added to the PATH variable , still unable to execute any 
file :( same error.

Please help!! Thanks in advance..



___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Python Interview Questions..

2011-05-24 Thread Neha P
Hey I'll be appearing for Job Interviews and wondering if anybody of you 
appeared for a Python Interview Or if on the other end as an interviewer.
 
Can you please share the questions asked?
 
That will be of great help :)

Regards,
Neha___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] subprocess.Popen() OR subprocess.call() ?

2011-06-12 Thread Neha P
Hi all,

I am newbie and want to know what is the difference between subprocess.Popen() 
and subprocess.call() ?
when is it best to use each one?

Any help appreciated!! 

Regards,
Neha___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


[Tutor] File parsing

2011-06-16 Thread Neha P
Hi all,
I know below query may sound silly, but can somebody suggest any better way of 
doing this:

It would be helpful.

I need to read a file line by line and print each line starting from the last 
word first:
 
C:\Python26>type file_reversing_program.txt

import sys
import string

f_obj=open(sys.argv[1],"r")

for eachline in f_obj:
   eachline=eachline[ :-1]# to eliminate the trailing "\n" 
    list_words=eachline.split(" ")
   list_words[0]=list_words[0]+"\n"# to add "\n" so that after line 1 is 
printed, line 2 should start on a new line 
    list_words.reverse()
    for every_word in list_words:
         print every_word,#  'comma' helps in printing words on same line,hence 
for last word we append "\n" 

f_obj.close()

C:\Python26>type input_file.txt

"Hi ther, how are you?"
I are doing fine, thank you.

C:\Python26>file_reversing_program.py input_file.txt

you?" are how ther,"Hi
you. thank fine, doing are I

Is there a better way of doing the above program, mainly the text highlighted 
in yellow,
Also if that is settled can there be a logic for getting the ouput more 
properly formatted (for text in blue) , 
say giving an output like  :
"you? are how ther, Hi"
you. thank fine, doing are I



Thanks,
Neha
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] File parsing

2011-06-16 Thread Neha P
Thanks James

I guess i have to use the same code for text in yellow... seems like ther's no 
other way... 

Regards,
Neha


From: James Reynolds 
To: Neha P 
Cc: "tutor@python.org" 
Sent: Thursday, June 16, 2011 2:43 PM
Subject: Re: [Tutor] File parsing


use split on the list to split it up. search each element for something like:

if '"' == element[:-1]:

if that evaluation is True, I would remove the quote mark from the word on the 
right side, and place a new one on the left side using something like '"' + 
element.

I would do the same thing for the other side in the same for loop, instead the 
evaluation would be:

if '"' == element[:1]:





On Thu, Jun 16, 2011 at 1:03 PM, Neha P  wrote:

Hi all,
>I know below query may sound silly, but can somebody suggest any better way of 
>doing this:
>
>It would be helpful.
>
>
>I need to read a file line by line and print each line starting from the last 
>word first:
> 
>C:\Python26>type file_reversing_program.txt
>
>import sys
>import string
>
>
>f_obj=open(sys.argv[1],"r")
>
>
>for eachline in f_obj:
>   eachline=eachline[ :-1]# to eliminate the trailing "\n" 
>    list_words=eachline.split(" ")
>   list_words[0]=list_words[0]+"\n"# to add "\n" so that after line 1 is 
>printed, line 2 should start on a new line 
>    list_words.reverse()
>    for every_word in list_words:
>         print every_word,#  'comma' helps in printing words on same 
>line,hence for last word we append "\n" 
>
>
>f_obj.close()
>
>
>C:\Python26>type input_file.txt
>
>"Hi ther, how are you?"
>I are doing fine, thank you.
>
>
>C:\Python26>file_reversing_program.py input_file.txt
>
>you?" are how ther,"Hi
>you. thank fine, doing are I
>
>
>Is there a better way of doing the above program, mainly the text highlighted 
>in yellow,
>Also if that is settled can there be a logic for getting the ouput more 
>properly formatted (for text in blue) , 
>say giving an output like  :
>"you? are how ther, Hi"
>you. thank fine, doing are I
>
>
>
>
>
>Thanks,
>Neha
>
>___
>Tutor maillist  -  Tutor@python.org
>To unsubscribe or change subscription options:
>http://mail.python.org/mailman/listinfo/tutor
>
>___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor