Re: [Tutor] python function to know the path of the program in execution *

2010-02-05 Thread Rohit Roger$
Answer :
 >>> import sys
>>> rohit = sys.argv[0]
>>> print rohit
 it returns the name of the path

On Fri, Feb 5, 2010 at 4:13 PM, David Hutto  wrote:

>  Junk Score: 2 out of 10 (below your Auto Allow 
> threshold)
> | Approve sender  | Block
> sender  | Block
> domain 
>
>
>
> --- On *Fri, 2/5/10, nikunj badjatya * wrote:
>
>
> From: nikunj badjatya 
> Subject: [Tutor] python function to know the path of the program in
> execution
> To: tutor@python.org
> Date: Friday, February 5, 2010, 5:08 AM
>
> Hi ,
> Is there any python function to know the path of the python program under
> execution.?
> If someone executes a program , he should come to know the path of the
> program..!!
> ex. suppose a user ABC is running prog.py which is in ~ directory, the user
> currently is in XYZ directory.
> [ a...@localhost XYZ ]$ python ~/prog.py
> The program's location is ~/prog.py
>
> This should be the outcome of the program.
>
> I tried with os.getcwd()
> os.getcwd() will return /path/to/folder/XYZ.
>
> Any suggestions?
>
> Thanks,
> Nikunj Badjatya
> Bangalore, India
>
> -Inline Attachment Follows-
>
> ___
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
>
> I think this is what you want:
>
> >>> import sys
> >>> sys.argv[0]
> 'C:\\Python26\\testingscripts\\lowdir.py'
> >>>
>
> David
>
>
>
> ___
> 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


Re: [Tutor] python function to know the path of the program in execution *

2010-02-05 Thread Rohit Roger$
sys.path[0] returns none


On Fri, Feb 5, 2010 at 5:36 PM, Spoorthi  wrote:

> sys.path[0] should be serving the purpose effectively I guess
>
>
> On Fri, Feb 5, 2010 at 5:29 PM, Rohit Roger$ wrote:
>
>> Answer :
>>  >>> import sys
>> >>> rohit = sys.argv[0]
>> >>> print rohit
>>  it returns the name of the path
>>
>> On Fri, Feb 5, 2010 at 4:13 PM, David Hutto wrote:
>>
>>>  Junk Score: 2 out of 10 (below your Auto Allow 
>>> threshold<https://www.boxbe.com/mail-screening>)
>>> | Approve sender <https://www.boxbe.com/anno?tc=1529381613_418589136> | 
>>> Block
>>> sender <https://www.boxbe.com/anno?tc=1529381613_418589136&disp=b> | Block
>>> domain <https://www.boxbe.com/anno?tc=1529381613_418589136&disp=b&dom>
>>>
>>>
>>>
>>> --- On *Fri, 2/5/10, nikunj badjatya * wrote:
>>>
>>>
>>> From: nikunj badjatya 
>>> Subject: [Tutor] python function to know the path of the program in
>>> execution
>>> To: tutor@python.org
>>> Date: Friday, February 5, 2010, 5:08 AM
>>>
>>> Hi ,
>>> Is there any python function to know the path of the python program under
>>> execution.?
>>> If someone executes a program , he should come to know the path of the
>>> program..!!
>>> ex. suppose a user ABC is running prog.py which is in ~ directory, the
>>> user currently is in XYZ directory.
>>> [ a...@localhost XYZ ]$ python ~/prog.py
>>> The program's location is ~/prog.py
>>>
>>> This should be the outcome of the program.
>>>
>>> I tried with os.getcwd()
>>> os.getcwd() will return /path/to/folder/XYZ.
>>>
>>> Any suggestions?
>>>
>>> Thanks,
>>> Nikunj Badjatya
>>> Bangalore, India
>>>
>>> -Inline Attachment Follows-
>>>
>>> ___
>>> Tutor maillist  -  Tutor@python.org<http://mc/compose?to=tu...@python.org>
>>> To unsubscribe or change subscription options:
>>> http://mail.python.org/mailman/listinfo/tutor
>>>
>>>
>>> I think this is what you want:
>>>
>>> >>> import sys
>>> >>> sys.argv[0]
>>> 'C:\\Python26\\testingscripts\\lowdir.py'
>>> >>>
>>>
>>> David
>>>
>>>
>>>
>>> ___
>>> 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
>>
>>
>
>
> --
> Spoorthi
>
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] python function to know the path of the program in execution *

2010-02-05 Thread Rohit Roger$
it tell the path upto the python file..

On Fri, Feb 5, 2010 at 5:43 PM, Spoorthi  wrote:

> The below data(in blue) made me converge upon sys.path[0] for this
> particular problem...I dont think it returns None if a Python script is
> used. Can anyone please correct me if I am wrong
>
> *As initialized upon program startup, the first item of this list, path[0],
> is the directory containing the script that was used to invoke the Python
> interpreter. If the script directory is not available (e.g. if the
> interpreter is invoked interactively or if the script is read from standard
> input), path[0] is the empty string, which directs Python to search
> modules in the current directory first. Notice that the script directory is
> inserted before the entries inserted as a result of PYTHONPATH.*
>
>
> On Fri, Feb 5, 2010 at 5:38 PM, Rohit Roger$ wrote:
>
>>
>> sys.path[0] returns none
>>
>>
>>
>> On Fri, Feb 5, 2010 at 5:36 PM, Spoorthi  wrote:
>>
>>> sys.path[0] should be serving the purpose effectively I guess
>>>
>>>
>>> On Fri, Feb 5, 2010 at 5:29 PM, Rohit Roger$ wrote:
>>>
>>>> Answer :
>>>>  >>> import sys
>>>> >>> rohit = sys.argv[0]
>>>> >>> print rohit
>>>>  it returns the name of the path
>>>>
>>>> On Fri, Feb 5, 2010 at 4:13 PM, David Hutto wrote:
>>>>
>>>>>  Junk Score: 2 out of 10 (below your Auto Allow 
>>>>> threshold<https://www.boxbe.com/mail-screening>)
>>>>> | Approve sender <https://www.boxbe.com/anno?tc=1529381613_418589136>| 
>>>>> Block
>>>>> sender <https://www.boxbe.com/anno?tc=1529381613_418589136&disp=b> | Block
>>>>> domain <https://www.boxbe.com/anno?tc=1529381613_418589136&disp=b&dom>
>>>>>
>>>>>
>>>>>
>>>>> --- On *Fri, 2/5/10, nikunj badjatya *wrote:
>>>>>
>>>>>
>>>>> From: nikunj badjatya 
>>>>> Subject: [Tutor] python function to know the path of the program in
>>>>> execution
>>>>> To: tutor@python.org
>>>>> Date: Friday, February 5, 2010, 5:08 AM
>>>>>
>>>>> Hi ,
>>>>> Is there any python function to know the path of the python program
>>>>> under execution.?
>>>>> If someone executes a program , he should come to know the path of the
>>>>> program..!!
>>>>> ex. suppose a user ABC is running prog.py which is in ~ directory, the
>>>>> user currently is in XYZ directory.
>>>>> [ a...@localhost XYZ ]$ python ~/prog.py
>>>>> The program's location is ~/prog.py
>>>>>
>>>>> This should be the outcome of the program.
>>>>>
>>>>> I tried with os.getcwd()
>>>>> os.getcwd() will return /path/to/folder/XYZ.
>>>>>
>>>>> Any suggestions?
>>>>>
>>>>> Thanks,
>>>>> Nikunj Badjatya
>>>>> Bangalore, India
>>>>>
>>>>> -Inline Attachment Follows-
>>>>>
>>>>> ___
>>>>> Tutor maillist  -  Tutor@python.org<http://mc/compose?to=tu...@python.org>
>>>>> To unsubscribe or change subscription options:
>>>>> http://mail.python.org/mailman/listinfo/tutor
>>>>>
>>>>>
>>>>> I think this is what you want:
>>>>>
>>>>> >>> import sys
>>>>> >>> sys.argv[0]
>>>>> 'C:\\Python26\\testingscripts\\lowdir.py'
>>>>> >>>
>>>>>
>>>>> David
>>>>>
>>>>>
>>>>>
>>>>> ___
>>>>> 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
>>>>
>>>>
>>>
>>>
>>> --
>>> Spoorthi
>>>
>>
>>
>
>
> --
> Spoorthi
>
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Variable: From input and output

2010-02-05 Thread Rohit Roger$
Answer:
Here is the code :

>>> firstname = raw_input("\n Enter your first name : ")
>>> lastname = raw_input("\n Enter your last name : ")
>>> print (" Printing Your Complete name.")
>>> print firstname + " " + lastname

Regards,
Rohit

On Fri, Feb 5, 2010 at 6:04 PM, Kent Johnson  wrote:

> On Thu, Feb 4, 2010 at 5:39 PM, ssiverling  wrote:
> >
> >
> > I uploaded a file.  I know it's not very impressive.
>
> Where did you upload it?
>
> For short programs you can just include them in your email.
>
> Also, please don't top-post, and please subscribe to the list.
>
> Kent
> >
> >
> > Kent Johnson wrote:
> >>
> >> On Thu, Feb 4, 2010 at 1:19 PM, ssiverling 
> wrote:
> >>
> >>> So I have been working on this example for a little while.  I looked
> for
> >>> the
> >>> answer before posting.  I tried to use two raw inputs, then use
> >>> sys.stdout.write, to add them together.  However I think I might need
> to
> >>> use
> >>> a variable.  Any help would be appreciated.  Thank you in advance.
> >>
> >> What have you done so far? If you show us some code we can better help
> >> you.
> >>
> >> Kent
> >> ___
> >> Tutor maillist  -  Tutor@python.org
> >> To unsubscribe or change subscription options:
> >> http://mail.python.org/mailman/listinfo/tutor
> >>
> >>
> > http://old.nabble.com/file/p27460922/psy psy
> > --
> > View this message in context:
> http://old.nabble.com/Variable%3A-From-input-and-output-tp27457364p27460922.html
> > Sent from the Python - tutor mailing list archive at Nabble.com.
> >
> > ___
> > 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 maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] python function to know the path of the program in execution * *

2010-02-05 Thread Rohit Roger$
ok..

On Fri, Feb 5, 2010 at 6:23 PM, Daniel Sarmiento wrote:

>  Junk Score: 2 out of 10 (below your Auto Allow 
> threshold<https://www.boxbe.com/mail-screening>)
> | Approve sender <https://www.boxbe.com/anno?tc=1530328725_1435846689> | Block
> sender <https://www.boxbe.com/anno?tc=1530328725_1435846689&disp=b> | Block
> domain <https://www.boxbe.com/anno?tc=1530328725_1435846689&disp=b&dom>
>
>
>
>  Date: Fri, 5 Feb 2010 17:43:37 +0530
>> From: Spoorthi 
>> To: "Rohit Roger$" 
>> Cc: tutor 
>> Subject: Re: [Tutor] python function to know the path of the program
>>in  execution *
>> Message-ID:
>><6c9f52051002050413o57bd76bax7ac5986b17304...@mail.gmail.com>
>> Content-Type: text/plain; charset="iso-8859-1"
>>
>> The below data(in blue) made me converge upon sys.path[0] for this
>> particular problem...I dont think it returns None if a Python script is
>> used. Can anyone please correct me if I am wrong
>>
>> *As initialized upon program startup, the first item of this list,
>> path[0],
>> is the directory containing the script that was used to invoke the Python
>> interpreter. If the script directory is not available (e.g. if the
>> interpreter is invoked interactively or if the script is read from
>> standard
>> input), path[0] is the empty string, which directs Python to search
>> modules
>> in the current directory first. Notice that the script directory is
>> inserted
>> before the entries inserted as a result of PYTHONPATH.*
>>
>> On Fri, Feb 5, 2010 at 5:38 PM, Rohit Roger$ 
>> wrote:
>>
>>
>>> sys.path[0] returns none
>>>
>>>
>>>
>>> On Fri, Feb 5, 2010 at 5:36 PM, Spoorthi  wrote:
>>>
>>>  sys.path[0] should be serving the purpose effectively I guess
>>>>
>>>>
>>>> On Fri, Feb 5, 2010 at 5:29 PM, Rohit Roger$ >>> >wrote:
>>>>
>>>>  Answer :
>>>>> >>> import sys
>>>>>
>>>>>> rohit = sys.argv[0]
>>>>>>>> print rohit
>>>>>>>>
>>>>>>>  it returns the name of the path
>>>>>
>>>>> On Fri, Feb 5, 2010 at 4:13 PM, David Hutto >>>> >wrote:
>>>>>
>>>>>   Junk Score: 2 out of 10 (below your Auto Allow threshold<
>>>>>> https://www.boxbe.com/mail-screening>)
>>>>>> | Approve sender <https://www.boxbe.com/anno?tc=1529381613_418589136>
>>>>>> |
>>>>>> Block sender<
>>>>>> https://www.boxbe.com/anno?tc=1529381613_418589136&disp=b>| Block
>>>>>> domain <https://www.boxbe.com/anno?tc=1529381613_418589136&disp=b&dom
>>>>>> >
>>>>>>
>>>>>>
>>>>>>
>>>>>> --- On *Fri, 2/5/10, nikunj badjatya *
>>>>>> wrote:
>>>>>>
>>>>>>
>>>>>> From: nikunj badjatya 
>>>>>> Subject: [Tutor] python function to know the path of the program in
>>>>>> execution
>>>>>> To: tutor@python.org
>>>>>> Date: Friday, February 5, 2010, 5:08 AM
>>>>>>
>>>>>> Hi ,
>>>>>> Is there any python function to know the path of the python program
>>>>>> under execution.?
>>>>>> If someone executes a program , he should come to know the path of the
>>>>>> program..!!
>>>>>> ex. suppose a user ABC is running prog.py which is in ~ directory, the
>>>>>> user currently is in XYZ directory.
>>>>>> [ a...@localhost XYZ ]$ python ~/prog.py
>>>>>> The program's location is ~/prog.py
>>>>>>
>>>>>> This should be the outcome of the program.
>>>>>>
>>>>>> I tried with os.getcwd()
>>>>>> os.getcwd() will return /path/to/folder/XYZ.
>>>>>>
>>>>>> Any suggestions?
>>>>>>
>>>>>> Thanks,
>>>>>> Nikunj Badjatya
>>>>>> Bangalore, India
>>>>>>
>>>>>> -Inline Attachment Follows-
>>>>>>
>>>>>> ___
>>>>>> Tutor maillist  -  Tutor@python.org<
>>>>>> http://mc/com