On 09/03/2017 at 22:23, xxxxxxxx wrote:
Hi there,
I want to split a String like "0123_456-Name_1438" and get the "Name_1438 ".
My tryout was this:
s = "0123_456-Name_1438"
for c in s:
if int(c) :
print c+" = ",int(c)," ",type(c)
else:
print c+" = ",type(c)
...a simple try if typecasting can be used to differenciate letters and numbers in a string.
The console tells: "ValueError: invalid literal for int() with base 10: 'N'"
Do you have an idea how that can be solved in python?
edit: I found str.isdigit() that does the trick ;)