Home > other >  Just started a small white Python questions asked
Just started a small white Python questions asked

Time:09-26

X=STR (input ())
Could you tell me how to determine the original input is int or STR?
Thank you

CodePudding user response:

Python 3 input in, are strings,

If you want to determine whether the string of pure digital, then can consider to use regular,

CodePudding user response:

 
Try:
X=input ()
Int_x=int (x)
Print (f 'input {x} is an integer! ')
Except:
Print (f 'input {x} is not an integer! ')

CodePudding user response:

Thank you for your help! I already know
  • Related