我昨天在我的Windows Vista PC上安装了Python 3.1,并惊讶地发现IDLE的版本是2.6.4,对于"Python 2.6.4(r264:75708,2009年10月26日,08:23:19)"[MSC v win32上的.1500 32位(英特尔)]
我希望使用IDLE来研究Python 3的一些新功能......
我想我被命令行困住了......
任何人都知道Python 3的IDLE是什么?
谢谢
是否有任何现有的Web应用程序可以让多个用户同时使用交互式IDLE类型会话?
就像是:
IDLE 2.6.4
Morgan: >>> letters = list("abcdefg")
Morgan: >>> # now, how would you iterate over letters?
Jack: >>> for char in letters:
print "char %s" % char
char a
char b
char c
char d
char e
char f
char g
Morgan: >>> # nice nice
Run Code Online (Sandbox Code Playgroud)
如果没有,我想创建一个.我可以使用哪些模块来模拟交互式会话吗?我想要一个这样的界面:
def class InteractiveSession():
''' An interactive Python session '''
def putLine(line):
''' Evaluates line '''
pass
def outputLines():
''' A list of all lines that have been output by the …Run Code Online (Sandbox Code Playgroud) 似乎IDLE(标准Python Windows安装的一部分)将不会正确执行多线程程序而不会出现令人讨厌的挂起或错误崩溃.有谁知道解决这个问题的方法?
以下程序将始终挂在IDLE中,但在使用Python解释器直接执行时正常完成:
import threading, time
printLock = threading.Lock()
def pl(s):
printLock.acquire()
print s
printLock.release()
class myThread( threading.Thread ):
def run(self):
i = 0
for i in range(0,30):
pl(i)
time.sleep(0.1)
t = myThread()
t.start()
while threading.activeCount() > 1:
time.sleep(1)
pl( time.time() )
print "all done!"
Run Code Online (Sandbox Code Playgroud)
样本输出:
U:\dev\py\multithreadtest>python mt.py
0
1
2
3
4
5
6
7
8
9
1277935368.84
10
11
12
13
14
15
16
17
18
19
1277935369.84
20
21
22
23
24
25
26
27
28
29 …Run Code Online (Sandbox Code Playgroud) Windows 7当我学习Python(3.2)时,我更喜欢使用IDLE而不是CMD.为了改变我可以导入我自己的脚本的路径,我使用了一个我在这个站点中找到的小技巧:我去了FILE> OPEN>目录> myscript然后运行它然后我就在这个目录上.
不过,我想知道是否有一个简单的命令,比如CD ......移动到正确的目录,而不使用技巧.
谢谢,
我刚刚在Mac OS X(Snow Leopard)上安装了python 2.6,当我开始IDLE时它会一直退出!
我删除了python的所有安装:rm -rf /Library/Frameworks/Python.Framework
然后重新安装它,我仍然得到同样的问题:(
任何想法可能是什么?
谢谢
我在SWIG中度过了一段时间,部分原因在于缺乏可供学习的优秀C++示例.我终于得到了第一个用SWIG编译的程序,但是遇到了麻烦.让我直接了解代码......
setup.py:
#!/usr/bin/env python
"""
setup.py file for SWIG example
"""
from distutils.core import setup, Extension
decklist_module = Extension('_decklist',
sources=['decklist_wrap.cxx', 'decklist.cpp'],
)
setup (name = 'decklist',
version = '0.1',
author = "Me",
description = """Testing!""",
ext_modules = [decklist_module],
py_modules = ["decklist"],
)
Run Code Online (Sandbox Code Playgroud)
decklist.hpp:
#include <boost/unordered_map.hpp>
class DeckList{
private:
boost::unordered_map<std::string, int> mainBoard;
boost::unordered_map<std::string, int> sideBoard;
public:
void addCard(std::string name, int cardCount);
int getCount(std::string cardName);
DeckList();
~DeckList();
};
Run Code Online (Sandbox Code Playgroud)
decklist.cpp:
#ifndef DECKLIST_H
#define DECKLIST_H
#include "decklist.hpp"
#include <stdio.h>
DeckList::DeckList(){
}
void DeckList::addCard(std::string cardName, …Run Code Online (Sandbox Code Playgroud) 我安装了Python 2.7(Windwos 7).但是,我无法加载GUI.我试图打开时没有回复.我重新安装了它,但同样的问题.可能是什么解决方案?
使用IDLE和Python版本2.7.3.只有当我开始一个新文件时,它会突出显示几行,然后在按下F5后停止.所以我的所有文字都变成了黑色.
如果那里有同样好/更好的命令行和编辑器组合,你可能总是建议它们.
我怎么写
>>> x = int(raw_input("Please enter an integer: "))
>>> if x < 0:
... x = 0
... print 'Negative changed to zero'
... elif x == 0:
... print 'Zero'
... elif x == 1:
... print 'Single'
... else:
... print 'More'
...
Run Code Online (Sandbox Code Playgroud)
在IDLE.一旦我写完第一行后按Enter键,它就会执行第一行,我无法编写完整的代码.我是python的新手,今天就开始了.任何帮助将不胜感激.
有没有一种方法可以检测用户已经切换到同一浏览器窗口中不同选项卡的javascript.
另外有一种方法可以检测用户是否已切换到与浏览器不同的窗口?
谢谢
python-idle ×10
python ×9
browser ×1
c++ ×1
gcc ×1
javascript ×1
macos ×1
python-2.6 ×1
python-3.x ×1
swig ×1