我有一个包含此文本的文本文件:
What's New in this Version
==========================
-This is the text I want to get
-It can have 1 or many lines
-These equal signs are repeated throughout the file to separate sections
Primary Category
================
Run Code Online (Sandbox Code Playgroud)
我只想获取 ========================== 和 Primary Category 之间的所有内容,并将该文本块存储在变量中。我认为以下匹配方法会起作用,但它给了我 NoMethodError: undefined method `match'
f = File.open(metadataPath, "r")
line = f.readlines
whatsNew = f.match(/==========================(.*)Primary Category/m).strip
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?提前致谢。
我希望ruby在当前文件夹中查找以特定扩展名结尾的文件.扩展名为.app.zip
我该怎么做?
页面上有2个图像具有相同的图像src链接.如果我使用以下代码,它将单击第一个图像,那么如何单击第二个图像?
browser.image(:src, "https://itc.mzstatic.com/itc/images/btn-grey-small-edit.png").click
Run Code Online (Sandbox Code Playgroud)