By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,805 Members | 1,202 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,805 IT Pros & Developers. It's quick & easy.

can you convert an empty string to a number?

P: 1
can you convert an empty string to a number?
Jul 24 '14 #1
Share this Question
Share on Google+
3 Replies


bvdet
Expert Mod 2.5K+
P: 2,851
What number would it be?
Jul 24 '14 #2

Expert 100+
P: 1,035
Expand|Select|Wrap|Line Numbers
  1. >>> a='1'; print (int('0'+a) + 3);
  2. 4
  3. >>> a=''; print (int('0'+a) + 3);
  4. 3
  5. >>> a='2'; print (int('0'+a) + 3);
  6. 5
  7. >>>
  8.  
Jul 24 '14 #3

Expert 100+
P: 619
Do you mean, can you copy an integer to a string? An example please, otherwise we just waste our time on things you don't want.
Jul 25 '14 #4

Post your reply

Sign in to post your reply or Sign up for a free account.