Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

string to tuple python

string = "mystring"
tuple1 = tuple(string)
# ('m', 'y', ' ', 's', 't', 'r', 'i', 'n', 'g')

tuple2 = string,
# ("my string",)
Comment

python string to tuple

l = list('abcd')  	        # ['a', 'b', 'c', 'd']
l = map(None, 'abcd')       # ['a', 'b', 'c', 'd']
l = [i for i in 'abcd']	    # ['a', 'b', 'c', 'd']

import re               # importing regular expression module
l = re.findall('.', 'abcd')
print(l)                	# ['a', 'b', 'c', 'd']
Comment

PREVIOUS NEXT
Code Example
Python :: numpy rolling average 
Python :: median of array python 
Python :: inverse matrix python numpy 
Python :: map and filter in python 
Python :: how to get local ip in python 
Python :: how to display values on top of bar in barplot seaborn 
Python :: python global variable across files 
Python :: how to plot labeled data with different colors 
Python :: python convert hex number to decimal 
Python :: rename row pandas 
Python :: python read binary trj file 
Python :: Discord python get member object by id 
Python :: how to assign a new value in a column in pandas dataframe 
Python :: python iterating through a string 
Python :: python last item in list 
Python :: Math Module tan() Function in python 
Python :: pandas print tabulate no index 
Python :: pie plot in python 
Python :: capitalize first letter of each word python 
Python :: scatter matrix plot 
Python :: check if string contains python 
Python :: pandas normalize columns 
Python :: string slices 
Python :: append to list py 
Python :: isalnum python 
Python :: relative import in python 
Python :: reverse python 
Python :: python split input to list 
Python :: python pip Failed to build cryptography 
Python :: method for detect that a float number is integer in python 
ADD CONTENT
Topic
Content
Source link
Name
9+9 =