Basic data types
numeric int, all functions, all in int
A1 = 123
A1 = 456
-INT
Convert a string to a number
A = "123"
Print (Type (a), a)
b = Int (a)
Print (type (b), B)
num = "0011"
v = int (num, base=16)
Print (v)
-Bit_lenght
# The binary of the current number, represented by at least n bits
R = Age.bit_length ()
String str
S1 = "ASDF"
S2 = "Asdffas"
# test = "ALex"
# First Letter Capitalized
# v = test.capitalize ()
# print (v)
# all lowercase, casefold, a lot of unknown to the corresponding lowercase
# V1 = Test.casefold ()
# print (v1)
# v2 = Test.lower ()
# Print (v2)
# Set the width and center the content
# 20-Finger total length
# * Blank unknown padding, one character, dispensable
# v = test.center (20, "medium")
# print (v)
# Look in the string to find the number of occurrences of the subsequence
# test = "ALEXALEXR"
# v = test.count (' ex ')
# print (v)
# test = "ALEXALEXR"
# v = test.count (' ex ', 5,6)
# print (v)
# owed
# encode
# decode
# What's the end of what?
# Start with what?
# test = "Alex"
# v = test.endswith (' ex ')
# v = test.startswith (' ex ')
# print (v)
# owed
# test = "12345678\t9"
# v = test.expandtabs (6)
# Print (V,len (v))
# start looking backwards, find the first one, get its unknown
# > or >=
# test = "Alexalex"
# Not found-1
# v = test.find (' ex ')
# print (v)
# Index not found, error ignored
# test = "Alexalex"
# v = test.index (' 8 ')
# print (v)
# formatting, replacing placeholders in a string with the specified values
# test = ' I am {name} ', age {A} '
# Print (test)
# v = test.format (name= ' Alex ', a=19)
# print (v)
# test = ' I am {0}, age {1} '
# Print (test)
# v = Test.format (' Alex ', 19)
# print (v)
# formatted, incoming value {"Name": ' Alex ', ' a ': 19}
# test = ' I am {name} ', age {A} '
# V1 = Test.format (name= ' DF ', a=10)
# v2 = Test.format_map ({"Name": ' Alex ', "a": 19})
# whether the string contains only letters and numbers
# test = "123"
# v = test.isalnum ()
# print (v)
Lists List
...
Ganso tuple
...
Dictionary Dict
...
boolean bool
...
Python basic data types and strings