- 帖子
- 171
- 积分
- 230
- 技术
- 0
- 捐助
- 0
- 注册时间
- 2022-7-9
|
本帖最后由 qd2024 于 2023-2-2 14:32 编辑
TXT文件中,分割位置行首有关键字,如★★★★★
以“★★★★★”为标记,把一个TXT文件分割 为多个TXT文件,
生成的TXT文件,以“★★★★★”所在行为首行,以这一行的文字内容为文件名,
“★★★★★”写标记了开始位置,第2个“★★★★★”,即是第2个TXT文件的开始,也是第1个文件的结束,最后一个到文件尾
但生成的文行首行和文件名中都不包含“★★★★★”
下面的示例文本,最后生成4个txt文件
Module1 unit1 What a delicious smell
Module1 unit2 You sound just like me!
Module2 unit1 What are you doing
Module2 unit2 They have been to many interesting places.
如标点中有非法字符,就删除非法字符,不用写到文件名中。
谢谢
文本原文示例:
★★★★★Module1 unit1 What a delicious smell
Tony: Mnn…What a delicious smell! Your pizza looks so nice.
Betty: Thanks! Would you like to try some?
Tony: Yes, please. It looks lovely, it smells delicious and mm, it tastes good.
Daming: What’s that on top?
Betty: Oh, that’s cheese. Do you want to try a piece?
Daming: Ugh! No, thanks. I’m afraid I don’t like cheese. It doesn’t smell fresh. It smells too strong and it tastes a bit sour.
Betty: Well, my chocolate cookies are done now. Have a try!
Daming: Thanks! They taste really sweet and they feel soft in the middle.
Tony: Are you cooking lots of different things? You look very busy!
Betty: Yes, I am! There’s some pizza and some cookies, and now I’m making an apple pie and a cake.
Daming: Apple pie sounds nice. I have a sweet tooth, you know. Shall I get the sugar?
Betty: Yes, please. Oh, are you sure that’s sugar? Taste it first. It might be salt!
Daming: No, it’s OK. It tastes sweet. It’s sugar.
Tony: What’s this? It tastes sweet too.
Betty: That’s strawberry jam, for the cake.
Daming: Good, everything tastes so sweet! It’s my lucky day!
★★★★★Module1 unit2 You sound just like me!
Hi Lingling,
Thanks for your last message. It was great to hear from you, and I can't wait to meet you.
I hope you will know me from my photo when I arrive at the airport. I'm quite tall, with short fair hair, and I wear glasses. I'll wear jeans and a T-shirt for the journey, but I'll also carry my warm coat. I've got your photo - you look very pretty. I'm sure we'll find each other!
Thanks for telling me about your hobbies. You sound just like me! I spend a lot of time playing classical music with my friends at school, but I also like dance music - I love dancing! I enjoy sports as well, especially tennis. My brother is in the school tennis team - I'm very proud of him! He's good at everything, but I'm not. Sometimes I get bad marks at school, and I feel sad. I should work harder.
You asked me, "How do yo feel about coming to China? "Well, I often feel a bit sad at first when I leave my mum and dad for a few days, and I'm quite shy when I'm with strangers. I feel nervous when I speak Chinese, but I'll be fine in a few days. I'm always sorry when I don't know how to do things in the right way, so please help me when I'm with you in China! Oh, I'm afraid of flying too. But I can't tell you how excited I am about going to China!
See you next week!
★★★★★Module2 unit1 What are you doing?
Tony: Hi, Lingling. What are you doing?
Lingling: I'm entering a competition.
Tony: What kind of competition?
Lingling: A speaking competition.
Tony: "Great. "It'll help you improve your speaking. And maybe you will win a prize.
Lingling: The first prize is "My dream holiday".
Tony: Have you ever won any prizes before?
Lingling: No, I haven't. I've always wanted to go on a dream holiday. But I can't afford it. The plane tickets are too expensive.
Tony: Well, good luck! I've also entered lots of speaking competitions, but haven't won any prizes. I've stopped trying now.
Lingling: That's a pity. Have you ever thought about other kinds of competitions?
Tony: What do you mean?
Lingling: look! Here's a writing competition: Around the world in 80 Days. To win it, you need to write a short story about a place you've visited.
Tony: That sounds wonderful, but I haven't travelled much. How can I write about it?
Lingling: Don't worry. It doesn’t need to be true! You can make it up.
Tony: You're right. I'll try. I hope I will win, then I will invite you to come with me.
Lingling: Sorry! The first prize is only the book called Around the World in 80 Day!
★★★★★Module2 unit2 They have been to many interesting places.
Mike Robinson is a fifteen-year-old American boy and his sister Clare is fourteen. At the moment, Mike and Clare are in Cairo in Egypt, one of the biggest and busiest cities in Africa.
They moved here with their parents two years ago. Their father, Peter works for a very big company. "The company has offices in many countries, and it has sent Peter to work in Germany, France and China before. "Peter usually stays in a country for about two years. Then the company moves him again. His family always goes with him.
The Robinsons love seeing the world. They have been to many interesting places. For example, in Egypt, they seen the Pyramids, travelled on a boat on the Nile River, and visited the palaces and towers of ancient kings and queens.
Mike and Clare have also begun to learn the language of the country, Arabic. This language is different from English in many ways, and they find it hard to spell and pronounce the words. However, they still enjoy learning it. So far they have learnt to speak German, French, Chinese and Arabic. Sometimes they mix the languages. "It's really fun, "said Clare.
The Robinsons are moving again. The company has asked Peter to work back in the US. Mike and Clare are happy about this. They have friends all over the word, but they also miss their friends in the US. They are counting down the days. |
|