Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ENV variable in Python
#1
I have this simple code:

#!/usr/bin/env python

import sys, re, os

NAS1=os.environ['NAS1']
print 'Value of NAS1: ' + NAS1

pwdfile='NAS1/admin/data/pswds'
print 'Value of pwdfile: ' + pwdfile
When I run this code, the "pwdfile" variable doesn't pick up the "NAS1" value from 2 lines above it.

Output:
$ ./search.py Value of NAS1: /u01/app/oracle/NAS1 Value of pwdfile: NAS1/admin/data/pswds
Expected output for 'pwdfile' = /u01/app/oracle/NAS1/admin/data/pswds

Please help me understand what I am doing wrong here. Thanks in advance.
Reply


Messages In This Thread
ENV variable in Python - by anandoracledba - Dec-05-2018, 10:50 PM
RE: ENV variable in Python - by Gribouillis - Dec-05-2018, 11:21 PM
RE: ENV variable in Python - by anandoracledba - Dec-06-2018, 12:10 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020