-
Notifications
You must be signed in to change notification settings - Fork 260
Expand file tree
/
Copy pathtypechk.py
More file actions
29 lines (25 loc) · 813 Bytes
/
typechk.py
File metadata and controls
29 lines (25 loc) · 813 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/env python
# coding:utf-8
'''
欢迎参加黄哥python远程视频培训,
帮你完成从不会写代码到会写代码解决问题的过渡。
https://github.com/pythonpeixun/article/blob/master/index.md
咨询qq:1465376564
黄哥Python培训 黄哥改写
Python 3
PEP 0237: Essentially, long renamed to int. That is,
there is only one built-in integral type, named int;
but it behaves mostly like the old long type.
Python3 long这个数据类型取消了
'''
def displayNumType(num):
print(num, 'is', end=",")
if isinstance(num, (int, float, complex)):
print('a number of type:', type(num).__name__)
else:
print('not a number at all!!')
displayNumType(-69)
displayNumType(9999999999999999999999)
displayNumType(98.6)
displayNumType(-5.2 + 1.9j)
displayNumType('xxx')