最美情侣中文字幕电影,在线麻豆精品传媒,在线网站高清黄,久久黄色视频

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

爛尾程序

2023-03-18 18:47 作者:ionyhzxxss  | 我要投稿

最近挺想做一個python寫入程序的,但是因為本人技術原因?qū)е聽€尾,現(xiàn)在將源代碼發(fā)布,希望大家能幫助完成

from easygui import *

msgbox('請確保你已經(jīng)在同文件夾內(nèi)創(chuàng)建文本文檔')

a=enterbox('請輸入文件名(加后綴名)')

x=open(a,'a')

a=textbox('請在下面粘貼上次保存的代碼(如果沒有輸入none)')

b='y'

c=[]

d=[]

e=[]

f=['while','for']

g=0

if (a!='none'):

? ? x.write(a)

while b=='y':

? ? a=buttonbox('是否要導入庫','無',('turtle','random','easygui','none'))

? ? b=enterbox('是否要導入多個庫(y/n)')

? ? if (a=='turtle'):

? ? ? ? x.write('from turtle import *')

? ? ? ? c=['forward','backword','right','left','circle','dot','begin_fill','end_fill','color']

? ? elif (a=='random'):

? ? ? ? x.write('from random import *')

? ? ? ? y=open('random.txt','r')

? ? ? ? d=['random','randint']

? ? elif (a=='easygui'):

? ? ? ? x.write('from easygui import *')

? ? ? ? msgbox('在使用這個庫之前,請確保您已安裝這個庫')

? ? ? ? e=['enterbox','msgbox','buttonbox']

? ? elif (a=='none'):

? ? ? ? break

c=c+d+e+f

a=buttonbox('接下來請問你要創(chuàng)建什么','無',('創(chuàng)建變量','創(chuàng)建函數(shù)','創(chuàng)建循環(huán)','調(diào)用函數(shù)'))

if a=='創(chuàng)建變量':

? ? b=enterbox('變量名')

? ? x.write(b+'+')

elif a=='創(chuàng)建函數(shù)':

? ? b=enterbox('函數(shù)名')

? ? x.write('def'+b+':')

? ? b='y'

? ? while b==y:

? ? ? ? g=enterbox('請?zhí)砑雍瘮?shù)')

? ? ? ? x.write(g)

? ? ? ? b=enterbox('是否繼續(xù)創(chuàng)建(y/n)')

elif a=='創(chuàng)建循環(huán)':

? ? a=buttonbox('創(chuàng)建哪種循環(huán)','無',('for','while'))

? ? if (a=='for'):

? ? ? ? b=enterbox('設置循環(huán)次數(shù)')

? ? ? ? x.write('for i in range('+b+'):')

? ? else:

? ? ? ? b=enterbox('請設置循環(huán)條件')

? ? ? ? x.write('while '+b+':')

elif a=='調(diào)用函數(shù)':

? ? a=buttonbox('請問你要調(diào)用哪個函數(shù)','w',c)

? ? for i in range (1,len(c)):

? ? ? ? if a==c[i]:

? ? ? ? ? ? b=enterbox('請輸入'+c[i]+'函數(shù)的參數(shù)(如果有多個參數(shù)的話請用逗號分割(a,b))')

? ? ? ? ? ? x.write(c[i]+'('+b+')')


爛尾程序的評論 (共 條)

分享到微博請遵守國家法律
新建县| 民勤县| 南溪县| 嘉禾县| 安义县| 全椒县| 仙游县| 长顺县| 比如县| 田东县| 龙岩市| 会昌县| 克山县| 鄂托克前旗| 吉首市| 茂名市| 休宁县| 瓦房店市| 十堰市| 广昌县| 禄丰县| 安吉县| 金川县| 莒南县| 四子王旗| 光山县| 新巴尔虎左旗| 晋江市| 中阳县| 南丹县| 吉首市| 雅安市| 舟曲县| 宁远县| 内黄县| 孙吴县| 健康| 晋江市| 麟游县| 平顶山市| 沈丘县|