Here’s one way to do it by slicing:
>>> list1 = ['f', 'o', 'o']
>>> list2 = ['hello', 'world']
>>> result = [None]*(len(list1)+len(list2))
>>> result[::2] = list1
>>> result[1::2] = list2
>>> result
['f', 'hello', 'o', 'world', 'o']
More Related Contents:
- Convert array dictionary to a dictionary python
- Tkinter assign button command in a for loop with lambda [duplicate]
- How to get current CPU and RAM usage in Python?
- Installing Python packages from local file system folder to virtualenv with pip
- How to find out the number of CPUs using python
- How to efficiently calculate a running standard deviation
- Listing available com ports with Python
- if A vs if A is not None:
- How can I plot a confusion matrix? [duplicate]
- How to extract an IP address from an HTML string?
- python: read lines from compressed text files
- How to split/partition a dataset into training and test datasets for, e.g., cross validation?
- Save a subplot in matplotlib
- django-filter use paginations
- Mocking a module import in pytest
- Add legends to LineCollection plot
- python: class attributes and instance attributes
- Use value of variable in lambda expression [duplicate]
- python – While Loop causes entire program to crash in Tkinter
- Is there an InnerText equivalent in BeautifulSoup?
- Extract the first paragraph from a Wikipedia article (Python)
- Create bool mask from filter results in Pandas [duplicate]
- Correlation heatmap
- Plot yerr/xerr as shaded region rather than error bars
- Function to determine if two numbers are nearly equal when rounded to n significant decimal digits
- Chrome Options in Python Selenium : Disable GPU vs Headless
- Why is B = numpy.dot(A,x) so much slower looping through doing B[i,:,:] = numpy.dot(A[i,:,:],x) )?
- Is there a numpy/scipy dot product, calculating only the diagonal entries of the result?
- Setting Mac OSX Application Menu menu bar item to other than “Python” in my python Qt application
- Save plot to image file instead of displaying it