Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use python variable

Shulou Source: shulou.com Published: 2022-06-03 04:32:42 09月29日 Update

This article will explain in detail how to use python variables for everyone, Xiaobian thinks it is quite practical, so share it with you as a reference, I hope you can gain something after reading this article.

pyton variables are dynamic variables, variables automatically match type;

Dynamic variables:

#!/ usr/bin/python

#dynamic variable

a = 10;

c = "abcd";

print 'dynamic variable'

print a;

print c;

1.int Type:

a.int (number/string) Return value: decimal number

print (int(104))104print (int('1002'))1002

b.int (string, base=2/4/8/10/16) Return value: decimal number

print (int('1002',base=16))4098

2. Float type:

a.float(number/string) return value: floating point number

print (float(1002))1002.0print (float ('1002 '))1002.0 About "how to use python variables" This article is shared here, I hope the above content can be of some help to everyone, so that you can learn more knowledge, if you think the article is good, please share it for more people to see.

Tags: Variables characters strings articles types dynamic decimal numbers more decimal good practical content articles floating points knowledge references help related Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS Linux Xiaomi Huawei Redmi