python変数
1988 ワード
名前付け、値付け、数値、文字列タイプ、メモリアドレス、異なるタイプの占有空間、フォーマット出力
# ctrl+/
# ctrl+d
print("hello world!")
print("hello world!")
'''
Python 。 , 。
Python , , , " " 。
(=) 。a=1
(=) , (=) 。
'''
'''
1、 、 。 , 。
2、 , 。
3、 Python 。(help()——keywords)
4、 。
5、 l O, 。
'''
a3_ = 10
bc_top = 20
lambdaIlo0 = 30
int1 = 10005
float2 = 1353.8
bool3 = True
string4 = ' !sdfr '
list1 = [1, 5.3, 'abc', [6, 8]]
tuple2 = (1, 2, 'abc')
dict3 = {'name': 'linda', 'age': 18}
set4 = {1, 2, 'abc'}
# print(type(int1))
# print(type(float2))
# print(type(bool3))
# print(type(string4))
# print(type(list1))
# print(type(tuple2))
# print(type(dict3))
# print(type(set4))
# ?
# ,
import sys
# print(sys.getsizeof(int1))
# print(sys.getsizeof(float2))
# print(sys.getsizeof(bool3))
# print(sys.getsizeof(string4))
# print(sys.getsizeof(list1))
# print(sys.getsizeof(tuple2))
# print(sys.getsizeof(dict3))
# print(sys.getsizeof(set4))
'''
print(" 1:", file_name, " 2:", new_name)
%
print(" 1 %s, 2 %s, %d " % (file_name,new_name,num))
format
print(" 1 {}, {:.0f} , 2 {}".format(file_name,num,new_name))
f,python3.6
print(f'My salary is {salary:10.3f}’)
print(f" 1 {file_name}, {num} , 2 {new_name}")
'''
# , 。
str3 = " "
str4 = " "
salary = 99999.99
# print(" ", str3, ", ", str4)
# print(" %s, %s。" % (str3, str4))
# print(" {}, {}。".format(str3, str4))
# print(f" {str3}, {str4}。")
# 10 ,3 3 f:float
print(f'My salary is {salary:15.3f}')