Skip to content

Commit

Permalink
字符串转化
Browse files Browse the repository at this point in the history
  • Loading branch information
swaynew authored Aug 10, 2019
1 parent b87f6fb commit 4892b83
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Homework/Duduanwangu/lz_episode_02/2z_zuoye_3.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# 将字符形式的整数或浮点数转化为int或float
# 不能用int和float函数强转


d = {'1': 1, '2': 2, '1.23': 1.23, '3.4': 3.4}
for k, v in d.items():
print('转换前数字' + k + '为:')
print(type(k))
print('转换后数字' + str(v) + '为:')
print(type(v))
print('\n')

0 comments on commit 4892b83

Please sign in to comment.