Get the App
SLTechnology News&Howtos  ›  Development  › 

What should be paid attention to when using python data types

Shulou Source: shulou.com Published: 2022-06-03 17:36:43 09月17日 Update

This article mainly introduces what you need to pay attention to when using the python data type. It is very detailed and has a certain reference value. Friends who are interested must finish reading it!

1. Pay attention to priority and calculate from left to right. Characters cannot be added to integer types, but can be transformed.

2. Integer and floating point types can also be converted to each other, non-numeric characters cannot be converted to integers, nor can they be floating point.

Example

# Integer int# floating point float# character type str#''can put a few paragraphs in the middle' 'name =' la''print (name) # type function name =' Whirlpool Naruto 'print (type (name)) # pay attention to priority and calculate # characters from left to right cannot be added to integer types However, you can transform name = 'Zhang San' age = 48print (name + str (age)) # isomorphic integers and floating-point types can also be converted to each other, but non-numeric characters cannot be converted into integers, nor can they be floating-point structures. thank you for reading all of the article "what do you need to pay attention to in the use of python data types?" Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Tags: Type character floating point integer data priority content number article transformation operation character type value interest function instance boy buddy more whirlpool Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Huawei MariaDB Redmi vpn Shulou Information