Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

name, *line = input().split()

>>> first, *rest = input().split()
>>> print(first)
>>> print(*rest)
'''
given_ input = hello my name is bob
hello
['my', 'name', 'is', 'bob']
'''
Comment

name, *line = input().split()

>>> a, b, *rest = range(5)
>>> a, b, rest
(0, 1, [2,3,4])
Comment

name, *line = input().split()

>>> a, *middle, c = range(4)
>>> a, middle, c
(0, [1,2], 3)
Comment

PREVIOUS NEXT
Code Example
Python :: drop 0 in np array 
Python :: keras normalize 
Python :: torch root mean square 
Python :: python synonym library 
Python :: numpy indexing arrays 
Python :: how to loop through pages of pdf using python 
Python :: python split 
Python :: python requests post form data 
Python :: python dataframe save 
Python :: use gpu for python code in vscode 
Python :: how to take out every even number from a list in python 
Python :: python loop backward 
Python :: df split into train, validation, test 
Python :: mean along third dimension array python 
Python :: zip a directory in python 
Python :: move column in pandas dataframe 
Python :: tqdm command that works both in notebook and lab 
Python :: python np get indices where value 
Python :: how to set pandas dataframe as global 
Python :: find the last point of line geopanda 
Python :: readlines 
Python :: python staticmethod property 
Python :: marshmallow default value 
Python :: math module in python 
Python :: Python how to use __lt__ 
Python :: how to write a dataframe to s3 object in python 
Python :: edit models in django admin 
Python :: adam optimizer keras learning rate degrade 
Python :: iterate over a list python 
Python :: create virtual environment python stack overflow 
ADD CONTENT
Topic
Content
Source link
Name
1+8 =