In this code snippet, we’ll show an example to check How to check if a list (array) is empty using Boolean true or false in Python.
How to check if a list (array) is empty using Boolean true or false in Python
x = []
not x # True
y = [1, 2]
not y # False
CC BY 4.0 added intro and tags – 30 Seconds of Code
Tags: python, python list, list, empty, false, true, bool
 
 
 
 
                                                             
                            
                            							
							
                         
                        
                                                    
                        
                        
                    
					
				  
					
					
					
				RELATED WEBSITES AND SERVICES
					
					These are paid advertisements or products and services ran by ourselves
					
                    
	
					
				   	
						
					
					
					   	
						
					
						
    
	
                        Privacy preserving, cookieless website visitor tracking for your website completely free. unrive.io
								 
 
					
		
					
										   	
						
					
					
							   	
						
					
						
    
	
                        Choose from over 100 quick & easy to use SEO, webmaster and developer tools. seoyex.com
								 
 
					
					
							   	
						
					
						
    
	
                        Lorum Ipsum Generator, List Randomiser Tool, List Alphabetizer Tools, Case Converter Tools. seoyex.com
								 
 
			
					
												   	
						
					
						
    
	
                        CSS Minifier, JS Minifier, HTML Formatter, CSS Formatter, JS Obfuscator Tools. unrivewebtools.com