What do you want to save?
Add Code snippet
New code examples
-
Python 2021-09-12 23:23:03
how to get user input of list in python
# number of elements n = int(input("Enter number of elements : ")) # Below line read inputs from user using map() function a = list(map(int,input("\nEnter the numbers : ").strip().split()))[:n] print("\nList is - "... Add solution -
Python 2021-09-12 15:09:03
parsing text in python
my_string = 'Names: Romeo, Juliet' # split the string at ':' step_0 = my_string.split(':') # get the first slice of the list step_1 = step_0[1] # split the string at ',' step_2 = step_1.split(',') # strip leading and trailing edge spaces of each item ... Add solution -
TypeScript 2021-09-08 23:05:03
how to take list as command line arguments in python
>>> input = "[2,3,4,5]" >>> map(float, input.strip('[]').split(',')) [2.0, 3.0, 4.0, 5.0] >>> A = map(float, input.strip('[]').split(',')) >>> print(A, type(A)) ([2.0, 3.0, 4.0, 5.0], <type 'list'>) Add solution