I have a String, which is formatted as following str="R%dC%d" for example Str=R150C123 and i want to save the numeric values in a variable for example in C Language this would be as following:
int c,r;
sscanf(Str,"R%dC%d",&r,&c);
in python i do it like this
c = int(str[str.find("C") + 1:])
r = int(str[:str.find("C")])
is there any other way to do this in python similler to how i've done it in C?
because my way in python takes a to much time to execute.
another example for another String format is: Str="%[A-Z]%d", for example Str= ABCD1293
i want to save 2 values, the first one is an Array or a String and the second one is the numbers
in C i do it like this:
int r;
char CC[2000];
sscanf(s,"%[A-Z]%d",CC,&r)
in Python like this:
for j in x:
if j.isdigit():
r = x[x.find(j):]
CC= x[:x.find(j)]
break
I dont think, that this is an elegant way to solve this kind of task in python. Can you please help me?