[Tutor] Read from large text file, find string save 1st string of each line where it appeared.
Steven D'Aprano
steve at pearwood.info
Mon Dec 28 11:12:30 EST 2015
On Mon, Dec 28, 2015 at 04:50:05PM +0530, sutanu bhattacharya wrote:
> {'115160371': [45349980, 22477811, 40566595, 26947037, 16178191, 12984002,
> 20087719, 19771564, 61746245, 17467721, 32233776, 31052980, 70768904,
> 16113331, 12414642]} <tutor at python.org>
>
> suppose 61746245 <tutor at python.org> is my searching string. so o/p will be
> 115160371 <tutor at python.org> (1st string). Area in between third bracket ([
> ]) is the searching area...
I don't understand the question.
What is "o/p"?
What do you mean, "searching string"? The string you are searching
*for*, or the string you are searching *in*?
You have something that looks like a dictionary { } followed by an email
address. What does that mean?
If you expect any useful answers, you will have to give a more careful
question. Please show some sample data, and expected result, using
valid Python syntax.
For example:
text = """This is a large string.
It contains many lines of text.
And some numbers: 22477811, 40566595, 26947037
And more numbers: 32233776, 31052980, 70768904
And lots more text.
"""
target = "233"
expected result: "32233776"
--
Steve
More information about the Tutor
mailing list