I have a line in a text file containing text as follows:
txt = "java.awt.GridBagLayout.layoutContainer"
I want to get everything up to the class name "GridBagLayout" .
I tried something like the following, but I can't figure out how to get rid of the "."
txt = re.findall(r'java\S?[^AZ]*', txt)
and I get the following: "java.awt."
instead of what i want: "java.awt"
Any directions on how I can fix this?
newdev14
source share