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 :: how to extract zip file using python 
Python :: abs in python 3 
Python :: add two strings together 
Python :: how to chang your facebook name 
Python :: list methods in python 
Python :: gevent with flask 
Python :: string.format() with {} inside string as string 
Python :: heapsort python 
Python :: python map list of int to string 
Python :: merge dataframe using pandas 
Python :: filter lambda python 
Python :: To Divide or Not To Divide 
Python :: How to efficiently search for a pattern string within another bigger one, in Python? 
Python :: Python sort list alpha 
Python :: Split the string using the separator 
Python :: for loop 
Python :: salvar plot python 
Python :: render to response django 
Python :: python gui kivvy 
Python :: change date format to yyyy mm dd in django template datepicker 
Python :: change tuple python 
Python :: streamlit - Warning: NumberInput value below has type int so is displayed as int despite format string %.1f. 
Python :: _getexif 
Python :: python script for downloading files from googledrive 
Python :: pytonh leer txt y quitar tildes acentos 
Python :: usign signal files django 
Python :: map to numpy array 
Python :: Making a delete request using python 
Python :: seaborn boxplot (both categorical and numeric data) 
Python :: use model from checkpoint tensorflow 
ADD CONTENT
Topic
Content
Source link
Name
6+9 =