Reputation: 982
In gmail when we conversation with others then at the end each email concatenate with previous conversation. by the help of python imaplib library i get the email body like below . Now i want to delete previous conversation and get only main message...
Input:
--------------------Now i Have--------------------------
Dear vaia,
Sale order fail to sync when it contain Generic Product. ....need to little
investigate about it.
This is a issue which is occurred if any product have salePrice of greated
then 2 decimal value like 33.34500 etc.
Now POS only use @ decimal values like 33.34 so please aware about this
about configuring prism to have always 2 decimal digits.
On Thu, Jan 26, 2017 at 9:23 PM, Abu Shaed Rimon <rimon@divine-it.net>
wrote:
>
> Dear Concern,
>
> Observation after update:-
>
> -- "+" sign working for add customer and Product but this button also
>
> Thank You.
>
>
> *...Best Regards,*
> http://www.divineit.net
>
>
> On Thu, Jan 26, 2017 at 5:44 PM, Khirun Nahar Urmi <urmi@divine-it.net>
> wrote:
>
>> Dear Rimon vaia,
>>
>>
>> Please take an update from git
>>
>> On Thu, Jan 26, 2017 at 3:24 PM, Abu Shaed Rimon <rimon@prismerp.net>
>> wrote:
>>
>>> Dear Concern,
>>>
>>> Please take a review about the mentioned observation in following :-
>>> *Helpdesk:* http://support.divineit.net
>>>
Output:
---------------------My Expectation-------------------------
Dear vaia,
Sale order fail to sync when it contain Generic Product. ....need to little
investigate about it.
This is a issue which is occurred if any product have salePrice of greated
then 2 decimal value like 33.34500 etc.
Now POS only use @ decimal values like 33.34 so please aware about this
about configuring prism to have always 2 decimal digits.
Upvotes: 0
Views: 227
Reputation: 17074
You can get it like so:
import re
with open(file, 'r') as f:
print re.findall(r'^.*?(?=On \w{3},)', f.read(), re.DOTALL)[0].strip()
Output:
Dear vaia,
Sale order fail to sync when it contain Generic Product. ....need to little
investigate about it.
This is a issue which is occurred if any product have salePrice of greated
then 2 decimal value like 33.34500 etc.
Now POS only use @ decimal values like 33.34 so please aware about this
about configuring prism to have always 2 decimal digits.
Regex:
^.*?(?=On \w{3},)
- Match everything from starting till first occurence of On \w{3},
pattern.
re.DOTALL
will make the .
match newline characters as well.
Upvotes: 1