I have a very long string that I extracted from a image file.
The string can look like this
...\n\nDate: 01.01.2022\n\nArticle-no: 123456789\n\nArticle description: asdfqwer 1234...\n...
How do I extract just the 10 characters after the substring "Article-no:"?
I tried solving it with a different approach using rfind like this but it tends to fail every now and then if the start and end string is not accurate.
s = "... string shown above ..."
start = "Article-no: "
end = "Article description: "
print(s[s.find(start)+len(start):s.rfind(end)])
>Solution :
you can use split:
string.split("Article-no: ", 1)[1][0:10]