python 引发异常《简明python教程》里的程序,在windows下运行出现了问题,请问应该怎么修改啊?_百度知道
python 引发异常《简明python教程》里的程序,在windows下运行出现了问题,请问应该怎么修改啊?
length :&'on&was&\nWhy&=&'.jpg" target="_blank" title="点击查看大图" class="ikqb_img_alink"><img class="ikqb_img" src="raw_input('.EOF&Enter& def&A&/zhidao/wh%3D450%2C600/sign=09bc296ab90e7bec238f0be51a1e950e/b3fbafd6:&exception&&'#;&<a href="  :&Other& & & ://a;you ,& &atleast),&=&  !/usr/bin/python# .' &ShortInputE print&did ://a.atleast& &/zhidao/pic/item/b3fbafd6;  .length&length.length& self.__init__(self)& s :&user-defined& &work&EOFEsomething .\&'do&at ://a.3; print&x,&continue&'%& & #&exception& & raise .atleast) if& &least ,&ShortInputException(len(s);=&x,&expecting ,&&) .' :&(x;of& & &as& & 'usual .pyclass&%d':&__init__( was& & &input&F Ewas& &len(s) :& &'can . print :&%d; &hereexcept .-->:&  ?' &  .jpg" esrc=" &3)&No&'an&/zhidao/wh%3D600%2C800/sign=1e60ab997dd98d0f166d224f4afd6;ShortInputEThe .ShortInputException(Exception);'class
提问者采纳
序是在Enter something--&提示后输入>,asd这些;&>,要重新输入得重新运行一遍程序不要在&>,&后面输入,ab
提问者评价
是哦,呵呵···谢谢啦
其他类似问题
22人觉得有用
您可能关注的推广
python的相关知识
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁1)">1)">1" ng-class="{current:{{currentPage==page}}}" ng-repeat="page in pages"><li class='page' ng-if="(endIndex<li class='page next' ng-if="(currentPage
相关文章阅读python tkinter gui库 问题 gif的图片不能显示 高手帮我看看出错在哪里?
python tkinter gui库 问题 gif的图片不能显示 高手帮我看看出错在哪里?
补充:为什么下面的代码放到s函数里运行正常,但为什么不显示图片?:
from Tkinter import *root = Tk()cv = Canvas(root,bg = 'white')def s():&&& img = PhotoImage(file = 'c:\\python.gif')&&&&&&& cv.create_image((150,150),image = img)&&& cv.pack()&&& print '0k's()root.mainloop()下面的代码运行正常可以显示图片:为什么放到函数里就不显示图片了呢?哪里的问题?
from Tkinter import *root = Tk()cv = Canvas(root,bg = 'white')img = PhotoImage(file = 'c:\\python.gif')f=imgcv.create_image((150,150),image = f)cv.pack()root.mainloop()
个人见解:好像是 img = PhotoImage(file = 'c:\\python.gif')定义在函数内部,函数运行结束后就自动释放了,因此没有了img对象,可以把img设成全局变量就可以显示出来。
google了一下,据说是tk的PhotoImage存在BUG,没有给引用的img计数增加,导致如果别处没有引用的话,会被回收。所以可以通过定义成全局变量等方法,暂时使用
的感言:谢谢你帮了我大忙!
相关知识等待您来回答
多媒体领域专家我的MAC OS 上装的python好像有问题,懂的朋友看一下这是什么问题?_百度知道
我的MAC OS 上装的python好像有问题,懂的朋友看一下这是什么问题?
7/python2;python2;Frameworks/2;lib/.7/.ps1#python2;System/.framework/.7/Versions/Versions/.pyc matches /Library/.framework/.pyc# /.exc_type;lib/.py;lib/.7/Library/,但又不像报错;PPVersions/,才出现这种 问题;Library/genericpath.7/。;lib/Python打开终端._#python2.framework/,请达人解答一下谢谢,# /.framework/.ps2# clear sys.pyimport genericpath # precompiled from /.7/.exitfunc#System/python2;Frameworks/.7/Frameworks/: 20 unfreed ints
我最近清理过一些语言包.7/Python..;2,会出现以下的这些东西.;System/。#Library/. 等等很多然后 退出python命令行时(exit())会出现;Library/warnings.argv#Frameworks/.framework/Versions/2.7/.path# clear sys.pyc matches /2;System/。;Frameworks/。好像在加载一些库;Versions/lib/2.7/warnings:# clear __builtin__;System/,以前不会的;Python,但有需要用到,键入python -v 查看版本时,我对python不是很懂.stderr# cleanup __main__# cleanup[1] encodings# cleanup[1] site# cleanup[1] sysconfig# cleanup[1] abc# cleanup[1] _weakrefset# cleanup[1] sre_constants# cleanup[2] os# cleanup sys# cleanup __builtin__# cleanup ints
提问者采纳
-v代表verbose, compressed=48 ->.txt (in=48) (out=48) (stored 0%)total bytes=48,会打印出更".txt会显示啰嗦".txt只会显示
adding.txt (stored 0%)而zip -v test:的信息。比如zip test.zip test: test.zip test--version才是最常用的查版本的参数
提问者评价
其他类似问题
python的相关知识
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁python 出现这个错误是什么原因_百度知道
python 出现这个错误是什么原因
提问者采纳
python 出现这个错误的原因是你没把代码写对
其他类似问题
按默认排序
其他2条回答
0)我们采用第三种方法, ';w'.c中设置的IO缓冲类型其实对之后执行的pyth,那我们想改变pyth.fileno().stdout.stdout.py中;,添加 sys.py是无效的.stdout = os,在pyth.stdout = os.py的IO缓冲类型应该怎么做呢;w', ':(1) 对python加-u参数(2) 加 PYTHONUNBUFFERED环境变量(3)
sys?很简单.fdopen(sys.py中设置就可以了.fileno()。Python中设置标准输出为无缓冲有以下三种方法.fdopen(sys, 0)到pyth所以之前我们在tcpServer
错误呢?把错误贴出来啊,这我怎么帮你解决啊?
python的相关知识
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁}