Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

how to convert a datatype to another

x = "3"
int(x)

y = "2.6"
float(y)

z = "1j"
complex(z)

print(typeof(x))
# Int
# float
# complex
Comment

PREVIOUS NEXT
Code Example
Python :: df index drop duplicates 
Python :: histogram chart plotly 
Python :: matrix diagonal sum leetcode in Python 
Python :: how to find and remove certain characters from text string in python 
Python :: Multidimensional Java Array 
Python :: django filter multiple conditions 
Python :: appending items to a tuple python 
Python :: Use a callable instead, e.g., use `dict` instead of `{}` 
Python :: django create view class 
Python :: seaborn green color palette python 
Python :: logical operators python 
Python :: import pyautogui 
Python :: How to take multiple input form python 
Python :: run python script on remote server 
Python :: django unique validator 
Python :: from django.urls import re_path 
Python :: python gaussian filter 
Python :: python check None 
Python :: python encode file 
Python :: check if any letter in string python 
Python :: Appending rows to a DataFrame 
Python :: how to create a button using tkinter 
Python :: python in stack implementation 
Python :: pandas subplots 
Python :: how to add value in array django 
Python :: argparse flag without value 
Python :: python how to convert a list of floats to a list of strings 
Python :: sum of product 1 codechef solution 
Python :: save and load model during training pytorch 
Python :: cache pyspark 
ADD CONTENT
Topic
Content
Source link
Name
2+6 =