Horje
python data type conversion Code Example
how to convert types of variablesin python
int(anyData) #any into integer
str(anyData) #any into string
ord(chr) #character into number
hex(int) #integer into hexadecimal string
oct(int) #integer into octal string
float(anyData) #any into float
tuple() #convert to tuple
set() #returns the type after converting to set
list() #convert any data type to a list
dict() #convert a tuple of order (key,value) into a dictionary
complex(real,imag) #converts real numbers to complex(real,imag) number
python: convert variable as character
df['myvar'] = df['myvar'].astype(str)
python data type conversion
equationStrToInt = '8 * 8'
eval(equationStrToInt)
type(equationStrToInt)
print(equationStrToInt)
strToList = 'GREPPER'
list(strToList)
type(strToList)
print(strToList)




Python

Related
how to see if a number is prime in python Code Example how to see if a number is prime in python Code Example
django get latest object Code Example django get latest object Code Example
print environment variables windows python Code Example print environment variables windows python Code Example
oserror: invalid cross-device link Code Example oserror: invalid cross-device link Code Example
information of environment variables in python Code Example information of environment variables in python Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
7