May-19-2022, 10:35 PM
(May-19-2022, 10:05 PM)Pedroski55 Wrote: Ah well, I presumed you would only be receiving frequency data as Hertz from some CIA outpost in Alaska!i am receiving from ham radio frequencies. :)
i am creating a function to handle the general case of a string with a number that
float()
(and int(s,10)
) can convert followed by any unit the caller may use (as long as the unit can be distinguished from the number). one str argument. one 2-tuple return value. the return value will have either float or int followed by a str having the unit. int if the number has no given '.' character. if the number has '.' but its fractional part is all zero, it will still be type float. or i may decide to not convert the number and have 2 str in the returned tuple. if there is no number at all in the argument str, raise ValueError. if there is no unit at all, return a tuple with the number and an empty str. if the argument is not str or bytes, raise TypeError. if the argument is bytes, decode that to str and use str, remembering to encode all str results to bytes.
Tradition is peer pressure from dead people
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.