What do you want to save?
Add Code snippet
New code examples
-
Python 2022-01-28 16:30:27
python get script name
# Option 1: Works for Python 3.4 + from pathlib import Path Path(__file__).name # ScriptName.py Path(__file__).stem # ScriptName # Option 2: use `os` library import os os.path.basename(__file__) # ScriptName.py os.path.splitext(os.path.basename(... Add solution -
Python 2022-01-23 23:55:18
python remove file with pattern
import os import glob # Get a list of all the file paths that ends with .txt from in specified directory file_list = glob.glob('/home/varung/Documents/python/logs/*.log') # Iterate over the list of filepaths & remove each file. for file_path in file... Add solution -
-
Python 2022-01-23 19:12:03
how to get tweets from twitter api in python
import os import tweepy as tw import pandas as pd consumer_key= 'yourkeyhere' consumer_secret= 'yourkeyhere' access_token= 'yourkeyhere' access_token_secret= 'yourkeyhere' auth = tw.OAuthHandler(consumer_key, consumer_secret) auth.set_access_token(access... Add solution
Best helpers
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5