Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python append n numbers to list

# Basic syntax:
your_list.extend([element]*number)
# Where:
#	- element is the element you want to add to your_list
#	- number is the number of times you want it repeated

# Note, .extend modifies your_list in place

# Example usage:
your_list = [1, 2, 3]
your_list.extend([0]*5)
print(your_list)
--> [1, 2, 3, 0, 0, 0, 0, 0]
Comment

PREVIOUS NEXT
Code Example
Python :: python convert dict to xml 
Python :: random picker in python 
Python :: deleting dataframe row in pandas based on column value 
Python :: how to print thgings in multiple linew in python 
Python :: python parse url get parameters 
Python :: python moving average pandas 
Python :: show all urls django extensions 
Python :: divide a column value in pandas dataframe 
Python :: date colomn to datetime 
Python :: python turn off printing 
Python :: Replace the string with NAN value 
Python :: how to save a pickle file 
Python :: example of django template for forms 
Python :: merge two Python dictionaries in a single expression 
Python :: shebang python 
Python :: python returen Thread 
Python :: hello world in python 
Python :: find where df series is null and print 
Python :: django radio button 
Python :: pip install for python 2 and python3 
Python :: python depth first search 
Python :: spyder - comment banch of codee 
Python :: how to resize tkinter window 
Python :: get ContentType with django get_model 
Python :: pandas write to excel 
Python :: how to export DataFrame to CSV file 
Python :: create column for year in dataframe python 
Python :: python talib install windows 
Python :: find substr within a str in python 
Python :: Clear All the Chat in Discord Channel With Bot Python COde 
ADD CONTENT
Topic
Content
Source link
Name
7+5 =