name = input('Enter your name please: ')
while name != str:
name = input('Please enter only letters for your name: ')
ss = input('Enter your Social Security Number: ')
while ss != int:
ss = input('Please enter only numbers for your social security number:')
所以我有这个基本的程序,询问用户他的名字和SS#,我想这样做,用户不能输入一个str或浮动他应该输入一个int。我试过这个,但它会永远循环,因为If语句正在检查输入是否是数据类型str或int,我该如何检查变量是int还是str?我怎样才能控制我的用户的输入
[询问用户的输入,直到他们给出有效的响应](http://stackoverflow.com/questions/23294658/asking-the-user-for-input-until-they-give-a-有效的响应) – wwii