带视频的可选发型 link
Optional hairstlyle with video link
我正在尝试创建一个随机发型生成器,该生成器给出一个发型并给某个link一个教程来创建生成器给出的以下发型。尽管代码确实给出了不同的发型,但我无法通过分配的 link 得到代码来给出不同的发型。相反,它只是继续输出代码开头给出的相同 link。
import random
a = "slicked back bun"
b = "puff"
c = "bantu knots"
d = "wash n go"
e = "mini twists"
f = "braid out"
g = "twist out"
h = "half up, half down"
i = "flat twists"
j = "perm rod set"
k = "flexi rod set"
l = "cornrows"
m = "space buns"
n = "finger coils"
o = "curly mohawk"
p = "afro"
q = "sleek high bun"
r = "two braids & low ponytail"
s = "halo braid"
t = "head wrap"
mylist = [a, b, c, d, e,f, g, h, i, j, k , l, m, n, o, p, q, r, s,
t]
def example():
print (random.choice(mylist))
if "puff" in mylist:
print("https://www.youtube.com/")
else:
print("no hairstyle today")
def example2():
raw_input("> ")
def example2():
raw_input("> ")
example()
问题应该是固定的 hairstlyles 存储在列表中而不是作为列表中的变量,youtube link 附加了随机发型。
import random
hairstyles = ["slicked+back+bun","puff","bantu+knots","wash+n+go","mini+twists","braid+out","twist+out","half+up,+half+down","flat+twists","perm+rod+set","flexi+rod+set","cornrows","space+buns","finger+coils","curly+mohawk","afro","sleek+high+bun","two+braids+&+low+ponytail","halo+braid","head+wrap"]
def example():
randomStyle=random.choice(hairstyles)
print("https://youtube.com/results?search_query="+randomStyle)
example()
我正在尝试创建一个随机发型生成器,该生成器给出一个发型并给某个link一个教程来创建生成器给出的以下发型。尽管代码确实给出了不同的发型,但我无法通过分配的 link 得到代码来给出不同的发型。相反,它只是继续输出代码开头给出的相同 link。
import random
a = "slicked back bun"
b = "puff"
c = "bantu knots"
d = "wash n go"
e = "mini twists"
f = "braid out"
g = "twist out"
h = "half up, half down"
i = "flat twists"
j = "perm rod set"
k = "flexi rod set"
l = "cornrows"
m = "space buns"
n = "finger coils"
o = "curly mohawk"
p = "afro"
q = "sleek high bun"
r = "two braids & low ponytail"
s = "halo braid"
t = "head wrap"
mylist = [a, b, c, d, e,f, g, h, i, j, k , l, m, n, o, p, q, r, s,
t]
def example():
print (random.choice(mylist))
if "puff" in mylist:
print("https://www.youtube.com/")
else:
print("no hairstyle today")
def example2():
raw_input("> ")
def example2():
raw_input("> ")
example()
问题应该是固定的 hairstlyles 存储在列表中而不是作为列表中的变量,youtube link 附加了随机发型。
import random
hairstyles = ["slicked+back+bun","puff","bantu+knots","wash+n+go","mini+twists","braid+out","twist+out","half+up,+half+down","flat+twists","perm+rod+set","flexi+rod+set","cornrows","space+buns","finger+coils","curly+mohawk","afro","sleek+high+bun","two+braids+&+low+ponytail","halo+braid","head+wrap"]
def example():
randomStyle=random.choice(hairstyles)
print("https://youtube.com/results?search_query="+randomStyle)
example()