Download this file
17 lines (11 with data), 272 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 | from Numeric import *
def is_string_like(obj):
try: obj + ''
except (TypeError, ValueError): return 0
return 1
y = arange(10)
print 'test1', is_string_like(y)
y.shape = 10,1
print 'test2', is_string_like(y)
y.shape = 1,10
print 'test3', is_string_like(y)
|
×
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.