On Thu, 10 Sep 2015 12:11:55 -0700, wxjmfauth wrote:
s = """1, 2, 3, 4
> ... #keyword1 ... 3, 4, 5, 6 ... 2, 3, 4, 5 ... #keyword2 ... 4, 5, 6
> ,7"""
s[s.find('keyword1') + len('keyword1'):s.find('keyword2') - 1]
> '\n3, 4, 5, 6\n2, 3, 4, 5\n'
#or s[s.find('keyword1') + len('keywor
Am 10.09.15 um 13:18 schrieb Gerald:
Hey,
is there a easy way to copy the content between 2 unique keywords in a .txt
file?
example.txt
1, 2, 3, 4
#keyword1
3, 4, 5, 6
2, 3, 4, 5
#keyword2
4, 5, 6 ,7
If "copying" does mean copy it to another file, and you are not obliged
to use Python, thi
Vlastimil Brom writes:
> just to add another possible approach, you can use regular expression
Now you have three problems: whatever the two problems are that you are
alleged to have whenever you decide to use regular expressions for
anything at all, plus all the people piling on you to tell that
2015-09-10 13:18 GMT+02:00 Gerald :
> Hey,
>
> is there a easy way to copy the content between 2 unique keywords in a .txt
> file?
>
> example.txt
>
> 1, 2, 3, 4
> #keyword1
> 3, 4, 5, 6
> 2, 3, 4, 5
> #keyword2
> 4, 5, 6 ,7
>
>
> Thank you very much
Hi,
just to add another possible approach, you
Gerald writes:
> Hey,
>
> is there a easy way to copy the content between 2 unique keywords in a
> .txt file?
>
> example.txt
>
> 1, 2, 3, 4
> #keyword1
> 3, 4, 5, 6
> 2, 3, 4, 5
> #keyword2
> 4, 5, 6 ,7
Depending on your notion of easy, you may or may not like itertools.
The following code gets
On Thu, 10 Sep 2015 09:18 pm, Gerald wrote:
> Hey,
>
> is there a easy way to copy the content between 2 unique keywords in a
> .txt file?
>
> example.txt
>
> 1, 2, 3, 4
> #keyword1
> 3, 4, 5, 6
> 2, 3, 4, 5
> #keyword2
> 4, 5, 6 ,7
>
>
> Thank you very much
Copy in what sense? Write to ano
Hey,
is there a easy way to copy the content between 2 unique keywords in a .txt
file?
example.txt
1, 2, 3, 4
#keyword1
3, 4, 5, 6
2, 3, 4, 5
#keyword2
4, 5, 6 ,7
Thank you very much
--
https://mail.python.org/mailman/listinfo/python-list