Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

pythons os module choose random file

import os
import random
import dircache

dir = 'some/directory'
filename = random.choice(dircache.listdir(dir))
path = os.path.join(dir, filename)
Comment

PREVIOUS NEXT
Code Example
Python :: pandas forward fill after upsampling 
Python :: pytube search feature 
Python :: array must not contain infs or NaNs 
Python :: python multiply matrices 
Python :: renpy scene vs show 
Python :: python dir all files 
Python :: lock window size tkinter 
Python :: change size of yticks python 
Python :: import py to exe 
Python :: How to use PatBlt in Python 
Python :: jupyter notebook attach image 
Python :: matplotlib pie label size 
Python :: convert categorical variable to numeric python 
Python :: convert string to operator python 
Python :: How to create an efficient median finder for a stream of values, in Python? 
Python :: pair plot python 
Python :: print underline text python 
Python :: python pandas how to load csv file 
Python :: pygame tetris game tutorial 
Python :: python for property in object 
Python :: how to get sum specific columns value in machine learning 
Python :: python rsi trading strategy 
Python :: Error: Could not locate a Flask application. You did not provide the "FLASK_APP" environment variable, and a "wsgi.py" or "app.py" module was not found in the current directory. 
Python :: numpy.datetime64 to datetime 
Python :: what is actually better duracell or energizer 
Python :: pandas rename single column 
Python :: python compare two json objects and get difference 
Python :: emacs region indent python 
Python :: add padding to 2d matrix p 
Python :: plotly scatter markers size 
ADD CONTENT
Topic
Content
Source link
Name
9+6 =