For example, is it possible to convert the input
x = 10hr
into something like
y = 10
z = hr
I considering slicing, but the individual parts of the string will never be of a fixed length -- for example, the base string could also be something like 365d or 9minutes.
I'm aware of split() and re.match which can separate items into a list/group based on delimitation. But I'm curious what the shortest way to split a string containing a string and an integer into two separate variables is, without having to reassign the elements of the list.
y, z = whatever_you_have_in_mind_that_gives_a_list(x)? (Did you just not know you can doy, z = some_2_element_list?)split()uses a delimiter, butre.match()doesn't have to. Rather, you tell it what part of the string to match with a regular expression and it returns that part.