Code: Alles auswählen
zins = '6,5A'
print(zins)
print(zins.replace(',','',1).isdigit())
while True:
if zins.replace(',','',1).isdigit() == True:
print('ok',zins)
break
else:
zins = str(input('Nochmal Zins: '))
print('ende')
6,5A
False
Nochmal Zins: a
Nochmal Zins: b
Nochmal Zins: c
Nochmal Zins: 6,5
ok 6,5
ende
Starte ich die xxx.py mit doppelklick oder python xxx.py in der command bringt er
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
C:\Python32>python xxx.py
6,5A
False
Nochmal Zins: a
Nochmal Zins: b
Nochmal Zins: c
Nochmal Zins: 6,5
Nochmal Zins: ?
Nochmal Zins: ?
Nochmal Zins: uswusw
Nochmal Zins:
Hier behauptet Python, das zins.replace(',','',1).isdigit() False ist. Das ganze ist mir ein Rätsel.
Weiss jemand Rat?