how do i read a string from a file up to a set character (for example reading the words "hello world ¬ this is a string" up to the¬) in python 3 -
sorry if english off, making in python , need fixing problem have encountered. problem im having need able take information in txt file point signalled key character such ¬, , need able take next part of string after 1st ¬ next ¬ , on. reason because strings of various lengths can , change, if have string
'znpbb t7<)!\owk_fegtit:7{.¬zo9?s9$v9vpd}z#emkc¬'
in note pad file need come out
'znpbb t7<)!\owk_fegtit:7{.'
and when want 2nd one, should come out as
'zo9?s9$v9vpd}z#emkc'
i use split:
s = 'znpbb t7<)!\owk_fegtit:7{.¬zo9?s9$v9vpd}z#emkc¬' s.split('¬') # returns ['znpbb t7<)!\\owk_fegtit:7{.', 'zo9?s9$v9vpd}z#emkc', '']
Comments
Post a Comment