python-3.3

whats the difference between python 3.3 and 3.3m [duplicate]

a 夏天 提交于 2019-12-09 14:20:08
问题 This question already has an answer here : Difference between python3 and python3m executables (1 answer) Closed 5 years ago . What's the difference between python 3.3 and 3.3m I'm using Ubuntu 13.04 Raring and on my system I have python2.7 and python3.3 (I know the differences between 2 and 3) But I also have installed python3.3m (and it's not a symlink to 3.3). So what does the m stand for? 回答1: python3 is a symbolic link to python3.3 python3.3 is a hard link to python3.3m And as @nneonneo

Python 3.3 - Connect with Oracle database

霸气de小男生 提交于 2019-12-09 12:53:31
问题 Is there a module for python 3.3 to connect with Oracle Databases? Which is the easiest to use? Something like the mysql module, only works with Oracle. Preferably version 10g, but 11g will do just fine. 回答1: There is: cx_Oracle # Install --> You should have oracle installed otherwise exception will be raised pip install cx_Oracle import cx_Oracle con = cx_Oracle.connect('pythonhol/welcome@127.0.0.1/orcl') print con.version con.close() http://www.orafaq.com/wiki/Python http://www.oracle.com

Installing Python 3.3 on Cygwin

柔情痞子 提交于 2019-12-09 11:36:27
问题 I'm having trouble installing Python 3.3 on Cygwin. I've tried installing from source, but make returns: gcc -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I. -IInclude -I./Include -DPy_BUILD_CORE -c ./Modules/signalmodule.c -o Modules/signalmodule.o In file included from Include/Python.h:84:0, from ./Modules/signalmodule.c:6: ./Modules/signalmodule.c: In function `fill_siginfo': ./Modules/signalmodule.c:745:60: error: `siginfo_t' has no member named `si_band'

how do I get python to compile with libz?

喜你入骨 提交于 2019-12-08 08:13:05
问题 the version of python 3.3 I just compiled from source: $ ldd ./python linux-gate.so.1 => (0xb776c000) libpthread.so.0 => /lib/i386-linux-gnu/libpthread.so.0 (0xb773b000) libdl.so.2 => /lib/i386-linux-gnu/libdl.so.2 (0xb7736000) libutil.so.1 => /lib/i386-linux-gnu/libutil.so.1 (0xb7731000) libm.so.6 => /lib/i386-linux-gnu/libm.so.6 (0xb7707000) libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xb7589000) /lib/ld-linux.so.2 (0xb776d000) versus my system version of python3 (3.2): $ ldd `which python3

Python closures

你。 提交于 2019-12-08 05:22:31
问题 def counter(x): def _cnt(): #nonlocal x x = x+1 print(x) return x return _cnt a = counter(0) print(a()) Above code gives the following error UnboundLocalError: local variable 'x' referenced before assignment Why this is not able to create a new object with value 'x+1' in the namespace of _cnt and bind it to x. we will have reference x in both function namespaces 回答1: As soon as you assign to a name in a given scope, all references to the same name inside the same scope are local. Hence x + 1

cx_Freeze and Python 3.3

社会主义新天地 提交于 2019-12-08 03:06:07
问题 So, I have some Python 3.3 code that I need to make an .exe from on Windows. I discovered the only way to do it is using cx_Freeze. But, I haven't even got further than installation. This question describes my problem perfectly (except I run Python 3.3), and has not been answered yet: installing/using cx_freeze When I try to run "python setup.py build" from cmd I get: "importerror: no module named cx_freeze" I can't get past this step, and have searched for a solution for an hour

How to download a file in parts

时光毁灭记忆、已成空白 提交于 2019-12-08 03:04:07
问题 I'm writing a program that downloads files anywhere up to a 1Gb in size. Right now I'm using the requests package to download files, and although it works (I think it times out sometimes) it is very slow. I've seen some examples multi-part download examples using urllib2 but I'm looking for a way to use urllib3 or requests, if that package has the ability. 回答1: How closely have you looked at requests' documentation? In the Quickstart documentation the following is described r = requests.get

Compare directories on file/folder names only, printing any differences?

[亡魂溺海] 提交于 2019-12-08 02:43:01
问题 How do I recursively compare two directories (comparison should be based only on file name) and print out files/folders only in one or the other directory? I'm using Python 3.3. I've seen the filecmp module, however, it doesn't seem to quite do what I need. Most importantly, it compares files based on more than just the filename. Here's what I've got so far: import filecmp dcmp = filecmp.dircmp('./dir1', './dir2') dcmp.report_full_closure() dir1 looks like this: dir1 - atextfile.txt -

PySerial and readline() return binary string - convert to regular alphanumeric string?

試著忘記壹切 提交于 2019-12-07 16:18:48
问题 I'm having an issue with PySerial and Python (3.3): The code I'm running (for now, this is just a simple test case) is as follows: ser = serial.Serial('/dev/ttyACM0', 115200) result = ser.readline() parsed = result.split(",") which gives the following error: TypeError: type str doesn't support the buffer API What's my stupid mistake? I think I've traced this to the fact that PySerial's readline is returning a binary string (new in python 3?) and that the string operation "split" is failing

Python - convert set-cookies response to dict of cookies

亡梦爱人 提交于 2019-12-07 13:21:46
问题 How to convert the response['set-cookie'] output string from httplib2 response like "cookie1=xxxyyyzzz;Path=/;Expires=Wed, 03-Feb-2015 08:03:12 GMT;Secure;HttpOnly, cookie2=abcdef;Path=/;Secure" to {'cookie1':'xxxyyyzzz','cookies2':'abcdef'} 回答1: Use http.cookies: >>> c = "cookie1=xxxyyyzzz;Path=/;Expires=Wed, 03-Feb-2015 08:03:12 GMT;Secure;HttpOnly, cookie2=abcdef;Path=/;Secure" >>> from http.cookies import SimpleCookie >>> cookie = SimpleCookie() >>> cookie.load(c) >>> cookie <SimpleCookie