C ตั้งโปรแกรมวิธีของผู้ใช้ที่นำเข้าข้อมูลที่ใช้งานได้เบอร์แล้วถ้ามันไม่ได้หรือไม่ถูกต้อง

รหัสตัวอย่าง

1
0

ปลั๊กอินสำหรับไพธอนตรวจสอบว่าข้อมูลเข้า()จะทำให้เกิดข้อผิดพลาด

try:
    # Note: Python 2.x users should use raw_input, the equivalent of 3.x's input
    age = int(input("Please enter your age: "))
except ValueError:
    print("Sorry, I didn't understand that.")
else:
	if age >= 18: 
    	print("You are able to vote in the United States!")
	else:
    	print("You are not able to vote in the United States.")
0
0

ปลั๊กอินสำหรับไพธอนสองตรวจสอบว่าต้องการที่จะประมวลผล funtion

age = sanitised_input("Enter your age: ", int, 1, 101)
answer = sanitised_input("Enter your answer: ", str.lower, range_=('a', 'b', 'c', 'd'))

หน้าคล้ายกัน

คล้ายกันหน้ากับตัวอย่าง

ในภาษาอื่นๆ

หน้านี้อยู่ในภาษาอื่นๆ

Русский
..................................................................................................................
English
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................
Балгарскі
..................................................................................................................
Íslensk
..................................................................................................................

ดังอยู่ในนี้หมวดหมู่

ดังหน้ากับตัวอย่างอยู่ในหมวดหมู่