โดย jirawoot » 24/06/2019 3:08 pm
โค้ด: เลือกทั้งหมด
a={'name','age','school'}
a.clear()
print(a)
- Selection_005.png (7.65 KiB) Viewed 984 times
โค้ด: เลือกทั้งหมด
a={'name','age','school'}
print(a)
a.copy()
print(a)
- Selection_006.png (7.81 KiB) Viewed 984 times
โค้ด: เลือกทั้งหมด
a={'name','age','school'}
dict=dict.fromkeys(a, 'test')
print(dict)
- Selection_007.png (8.05 KiB) Viewed 984 times
โค้ด: เลือกทั้งหมด
a={'name':'test','age':22,'school':'mindphp'}
print(a.get('name'))
- Selection_008.png (8.66 KiB) Viewed 984 times
โค้ด: เลือกทั้งหมด
a={'name':'test','age':22,'school':'mindphp'}
print(a.items())
- Selection_009.png (8.46 KiB) Viewed 984 times
โค้ด: เลือกทั้งหมด
a={'name':'test','age':22,'school':'mindphp'}
print(a.keys())
- Selection_010.png (7.9 KiB) Viewed 984 times
โค้ด: เลือกทั้งหมด
a={'name':'test','age':22,'school':'mindphp'}
print(a.setdefault('name'))
print(a.setdefault('age'))
- Selection_011.png (5.86 KiB) Viewed 984 times
โค้ด: เลือกทั้งหมด
a={'name':'test','age':22,'school':'mindphp'}
b={'gender':'women'}
a.update(b)
print(a)
- Selection_012.png (8.2 KiB) Viewed 984 times
โค้ด: เลือกทั้งหมด
a={'name':'test','age':22,'school':'mindphp'}
print(a.values())
- Selection_013.png (8.4 KiB) Viewed 984 times
[code]
a={'name','age','school'}
a.clear()
print(a)
[/code]
[attachment=8]Selection_005.png[/attachment]
[code]
a={'name','age','school'}
print(a)
a.copy()
print(a)
[/code]
[attachment=7]Selection_006.png[/attachment]
[code]a={'name','age','school'}
dict=dict.fromkeys(a, 'test')
print(dict)[/code]
[attachment=6]Selection_007.png[/attachment]
[code]
a={'name':'test','age':22,'school':'mindphp'}
print(a.get('name'))
[/code]
[attachment=5]Selection_008.png[/attachment]
[code]
a={'name':'test','age':22,'school':'mindphp'}
print(a.items())
[/code]
[attachment=4]Selection_009.png[/attachment]
[code]
a={'name':'test','age':22,'school':'mindphp'}
print(a.keys())
[/code]
[attachment=3]Selection_010.png[/attachment]
[code]
a={'name':'test','age':22,'school':'mindphp'}
print(a.setdefault('name'))
print(a.setdefault('age'))
[/code]
[attachment=2]Selection_011.png[/attachment]
[code]
a={'name':'test','age':22,'school':'mindphp'}
b={'gender':'women'}
a.update(b)
print(a)
[/code]
[attachment=1]Selection_012.png[/attachment]
[code]
a={'name':'test','age':22,'school':'mindphp'}
print(a.values())
[/code]
[attachment=0]Selection_013.png[/attachment]