我尝试安装 ByeBug,因为调试器在 ruby 2.2.x 中不再工作。我已经安装了 devkit gem。但现在,当我尝试安装 ByeBug gem 时,它会执行以下操作。任何其他以前的版本也会给出相同的错误。
“未安装以下 gem:byebug (4.0.5):已取消”
我是Python初学者无法理解我的头脑.如何更改例如a = [[1,2],[3,4],[5,6]]
成"12\n34\n56"字符串格式.
这是我得到的,但它与每个数字进入换行符.
def change(a):
c = ""
for r in a:
for b in r:
c += str(b) + "\n"
return c
Run Code Online (Sandbox Code Playgroud) 我需要帮助如何在这两个明星之间获得大写.
INPUT: "S*t*a*r*s are every*where*"
OUTPUT: "STaRs are everyWHERE"
我的代码在这里:
def trans(s):
x = ""
a = False
for j in range(len(s)):
if s[j] == "*" or a:
a = True
if a:
x += s[j].upper()
else:
x += s[j]
return "".join(x.replace("*",""))
Run Code Online (Sandbox Code Playgroud)
问题是我不知道循环回到哪里False.现在它只是看到*并使一切都变成大写.

我想要的是删除其中有两个以上连续元音的单词.所以输入:
s = " There was a boat in the rain near the shore, by some mysterious lake"
Run Code Online (Sandbox Code Playgroud)
输出:
[boat,rain,near,mysterious]
Run Code Online (Sandbox Code Playgroud)
所以这是我的代码.我只是想知道是否有更好的方法来做到这一点或这是否足够有效.如果你能用python dict或列表做到这一点好吗?:)我是python的新手所以是的.:)评论会很好.
def change(s):
vowel = ["a","e","i","o","u"]
words = []
a = s[:].replace(",","").split()
for i in vowel:
s = s.replace(i, "*").replace(",","")
for i,j in enumerate(s.split()):
if "**" in j:
words.append(a[i])
return words
Run Code Online (Sandbox Code Playgroud) python ×3
algorithm ×1
debugging ×1
list ×1
performance ×1
python-3.x ×1
ruby ×1
string ×1
uppercase ×1