Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

print random string from list python

import random

list = ["Item 1", "Item 2", "Item 3"]			# List
item = random.choice(list)						# Chooses from list
print(item)					# Prints choice

# From stackoverflow
# Tried and tested method
Comment

PREVIOUS NEXT
Code Example
Python :: majority in array python 
Python :: matplotlib x label rotation 
Python :: perfect number in python 
Python :: how to find the most frequent value in a column in pandas dataframe 
Python :: tensorflow mnist dataset import 
Python :: install easygui 
Python :: seaborn axis limits 
Python :: tk table python 
Python :: python how to get project location 
Python :: python messagebox 
Python :: cv2.imshow 
Python :: python perfect square 
Python :: python read file delete first line 
Python :: python requests get title 
Python :: how to replace a word in csv file using python 
Python :: how to get random word from text file in python 
Python :: python iterate dictionary in reverse order 
Python :: python how to find the highest number in a dictionary 
Python :: how to permanently store data in python 
Python :: pandas drop empty columns 
Python :: unimport library python 
Python :: beautifulsoup find by class 
Python :: save crontab python to file 
Python :: pandas rename column 
Python :: extract first letter of column python 
Python :: python shuffle list 
Python :: list of prime numbers in python 
Python :: django how to set a navbar active 
Python :: RuntimeError: Attempting to deserialize object on a CUDA device but torch.cuda.is_available() 
Python :: python requests.get timeout 
ADD CONTENT
Topic
Content
Source link
Name
8+8 =