python文件运行在浏览器中打开_如何在web浏览器中本地运行(.py)Python文件?

有没有办法在不运行web服务器的情况下,在web浏览器上本地运行(.py)Python文件?也不使用外部服务。因此,如果internet不可用,该文件仍

有没有办法在不运行web服务器的情况下,在web浏览器上本地运行(.py)Python文件?也不使用外部服务。因此,如果internet不可用,该文件仍将在浏览器中运行。我想在我的电脑上用Chrome或IE运行这个代码。谢谢。在def concept(phrase):

# split var(phrase) at spaces and assign to var(words)

words = phrase.split()

# use this to list python file titles and links to open them

files = {1:"file0001.txt",

2:"file0002.txt",

3:"file0003.txt",

4:"file0004.txt",

5:"file0005.txt",

6:"file0006.txt",

7:"file0007.txt",

8:"file0008.txt",

9:"file0009.txt"}

# change keys to searchable simple keyword phrases.

concepts = {'GAMES':[1,2,4,3,3],

'BLACKJACK':[5,3,5,3,5],

'MACHINE':[4,9,9,9,4],

'DATABASE':[5,3,3,3,5],

'LEARNING':[4,9,4,9,4]}

# iterate through all var(words) found in var(word)

for word in words:

# convert to uppercase, search var(word) in dict 'concepts', if not found return not found"

if word.upper() not in concepts:

print("'{}':Not Found in Database \n" .format(word)) not in concepts

else:

# for matching keys in dict 'concept' list values in dict 'files'

for pattern in concepts[word.upper()]:

print(files[pattern])

# return input box at end of query

while True:

concept(input("Enter Concept Idea: "))

发布者:admin,转转请注明出处:http://www.yc00.com/web/1753979619a5104100.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信