kbalamuk 0 Newbie Poster 15 Years Ago How do I access windows environment variables using Python? eg. if I have the following: set junk=C:\temp\junk how do I access 'junk' from python? python 0 0 Share nezachem 616 Practically a Posting Shark 15 Years Ago Copy to Clipboardos.environ['junk'] should do it. 0 0 Share AutoPython 5 Junior Poster 15 Years Ago Type: Copy to Clipboardimport os os.system("set") To view the system variables. To use one of them you just: Copy to Clipboardimport os os.system("%variable%") This works with windows, but nothing else. 0 0 Share Share Facebook Twitter LinkedIn Reply to this topic Be a part of the DaniWeb community We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge. Sign Up — It's Free!
nezachem 616 Practically a Posting Shark 15 Years Ago Copy to Clipboardos.environ['junk'] should do it. 0 0 Share
AutoPython 5 Junior Poster 15 Years Ago Type: Copy to Clipboardimport os os.system("set") To view the system variables. To use one of them you just: Copy to Clipboardimport os os.system("%variable%") This works with windows, but nothing else. 0 0 Share