python - List from string of digits question -


I am getting a string from the input, which consists of separate digits from the space (1 5 6 3). First of all, I am trying to check that there are only digits in the input that are with the isdigit () function, but because of the blank space I can not do it for work then I can use the string () function I convert a string using

I have only digits for creating and suiting the list of inputs, and send a message and a new input. Is it possible to create an exception for space and add a parameter to isdigit ()?

Thanks

What you're describing is an your leap Appearing prior to approach, that is, first checking that the input is consistent and then it has to be parsed. It is more dragon to ask for an approach with easy permission, that is, just do it and handle exceptions:

  s = raw_input () # input () Try Python 3: Exclude numbers = map (ink, s.split ()) ValueError: print ('invalid format')    

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -