What should be paid attention to in python data type conversion
This article is about what you need to pay attention to in python data type conversion. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
1. Float and int can be converted to complex, but not vice versa.
2. Plural complex can be converted into string, and the converted string has parentheses and a plus sign.
Parentheses and plus signs add length and length as part of the string.
3. Convert to list list and tuple tuple, where s must be a sequence.
Such as strings, lists, tuples, which cannot be numbers, convert strings into single characters, lists, and tuples.
Example
A = "123sa" b=list (a) c=tuple (a) print (b) print (c)
Sample output:
Thank you for your reading. This is the end of this article on "what do you need to pay attention to in python data type conversion?". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!