ฟังก์ชัน ord() ใน Python ให้ค่า ordinal ของตัวอักษร (ASCII) ใช้หา ASCII codes ได้ดังนี้
ตัวอย่าง
s = "Hello"
for c in s:
print(ord(c))
ผลลัพธ์
72 101 108 108 111
ฟังก์ชัน ord() ใน Python ให้ค่า ordinal ของตัวอักษร (ASCII) ใช้หา ASCII codes ได้ดังนี้
s = "Hello"
for c in s:
print(ord(c))
72 101 108 108 111