What do you want to save?
Add Code snippet
New code examples
-
Python 2022-03-10 05:25:27
how to open file explorer in python
import os import subprocess FILEBROWSER_PATH = os.path.join(os.getenv('WINDIR'), 'explorer.exe') def explore(path): # explorer would choke on forward slashes path = os.path.normpath(path) if os.path.isdir(path): subprocess.run([FILEB... Add solution -
Python 2022-02-27 20:35:07
.env files in repl
#in the ".env" file. THIS IS FOR PYTHON TOKEN=38zdJSDF48fKJSD4824fN DB_USERNAME="admin" # defining variables like you'd do in python but secret DB_PASSWORD=w0ws0secure!! #in the "main.py" file import os print(os.getenv(&quo... Add solution -
Python 2021-11-09 21:06:09
telegram python news
import os from sqlalchemy import create_engine from sqlalchemy.orm import Session from telegram_news.template import InfoExtractor, NewsPostman # Three required fields: # Your bot token gotten from @BotFather bot_token = os.getenv("TOKEN") # A... Add solution -
Go 2021-10-13 23:51:04
init function in golang
// initializing variables var ( home = os.Getenv("HOME") user = os.Getenv("USER") gopath = os.Getenv("GOPATH") ) func init() { fmt.Printf("%v\n", home) fmt.Printf("%v\n", user) fmt.Printf("... Add solution -
Python 2021-10-04 02:40:05
how to uninstall python-dotenv
import os from pathlib import Path from dotenv import load_dotenv # Get the base directory basepath = Path() basedir = str(basepath.cwd()) # Load the environment variables envars = basepath.cwd() / '.env' load_dotenv(envars) # Read an environment variabl... Add solution -
Python 2021-09-20 22:15:02
get environment variables python
import os # Set environment variables os.environ['API_USER'] = 'username' os.environ['API_PASSWORD'] = 'secret' # Get environment variables USER = os.getenv('API_USER') PASSWORD = os.environ.get('API_PASSWORD') # Getting non-existent keys FOO = os.gete... Add solution -
Python 2021-09-09 02:26:04
python import environment variables
import os # Set environment variables os.environ['API_USER'] = 'username' os.environ['API_PASSWORD'] = 'secret' # Get environment variables USER = os.getenv('API_USER') PASSWORD = os.environ.get('API_PASSWORD') # Getting non-existent keys FOO = os.gete... Add solution