Hello,
This is my first post here..
Using Python 2.7, and I am relatively new to python.
I am trying to find a way to make a function for replacing the same value in several string-variables. As of now I am replacing the value by each string (see below).
The variables p1, p2 and p3 are strings with the current syntax: xxx.xx - example: p1 = 990.21, and I want to find out if they are numeric or not.
This is my first post here..
Using Python 2.7, and I am relatively new to python.
I am trying to find a way to make a function for replacing the same value in several string-variables. As of now I am replacing the value by each string (see below).
The variables p1, p2 and p3 are strings with the current syntax: xxx.xx - example: p1 = 990.21, and I want to find out if they are numeric or not.
if p1.replace('.','').isdigit(): pass else: print 'P1 NOT ok' if p2.replace('.','').isdigit(): pass else: print 'P2 NOT ok' if p3.replace('.','').isdigit(): pass else: print 'P3 NOT ok'I have tried doing the following, but I get an tuple-error: attributeerror 'tuple' object has no attribute 'replace'
if (p1, p2, p3).replace('.','').isdigit(): pass else: print 'P NOT ok'The internet has given me no answers so far - could be that I do not know what exactly to search for..