Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

string problems

Name: Anonymous 2013-05-06 4:51

hey guys having some issues with a program

a = float (raw_input ("enter int or float: "))

with this piece of code, every time the input is randomly a string it crashes my program, is there any way to tell python that it's okay to be a string and ignore it????

i was thinking something like....
type (a)
if a == <type 'str'>...IGNORE IT!
...and so on and so forth

didn't seem to work.. any ideas/

Name: Anonymous 2013-05-06 22:10

type cast
cin >> float(<str>);

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List