Questions tagged [python-3.3]

For issues that are specific to Python 3.3. Use the more generic [python] and [python-3.x] tags where possible.

Python is a dynamically and strongly typed programming language whose design philosophy emphasizes code readability. Two significantly different versions of Python (2 and 3) are in use.

Use this tag if your question is specifically about . If your question applies to Python in general, use the tag . If your question applies to Python 3.x but not to Python 2, use the tag . If you aren't sure, tag your question and mention which version you're using in the body of your question.

Python 3.3 was released on September 29, 2012, and has a number of new features:

Syntax:

  • The yield from expression for generator delegation is introduced.
  • The u'unicode' syntax (which disappeared in Python 3.0) returns.

New standard library modules:

  • faulthandler - helps debugging low-level crashes.
  • ipaddress - high-level objects representing IP addresses and masks.
  • lzma - compress data using the XZ / LZMA algorithm.
  • unittest.mock - replace parts of your system under test with mock objects.
  • venv - Python virtual environments, as in the popular virtualenv package.

... as well as a reworked I/O exception hierarchy, rewritten import machinery based on importlib, more compact unicode strings, and more compact attribute dictionaries.

The C Accelerator for the decimal module has also been significantly improved, as has the unicode handling in the email module.

Finally, for security reasons, hash randomization is now switched on by default.

1158 questions
21
votes
5 answers

ImportError: No module named '_sqlite3' in python3.3

sqlite3 error import sqlite3 Traceback (most recent call last): File "", line 1, in File "/usr/local/lib/python3.3/sqlite3/__init__.py", line 23, in from sqlite3.dbapi2 import * File…
Droid
  • 1,318
  • 8
  • 22
  • 34
21
votes
3 answers

subprocess and Type Str doesnt support the buffer API

I have cmd = subprocess.Popen('dir',shell=True,stdout=subprocess.PIPE) for line in cmd.stdout: columns = line.split(' ') print (columns[3]) have error in line 3 Type Str doesnt support the buffer API. What am i doing wrong i am on Python 3.3
Nick Loach
  • 313
  • 1
  • 3
  • 8
20
votes
5 answers

In Python 3.x make print work like in Python 2 (as statement)

I wonder if the print function can be made work (without changing the syntax all over the place) like in Python 2 and earlier. So I have the statement like: print "Hello, World!" And I like that syntax to work in Python 3. I've tried importing the…
paul23
  • 7,226
  • 9
  • 44
  • 108
20
votes
4 answers

Modern GUI programming in Python 3.3

I am putting together a few programs, and it's about time to start making GUI's for some of them. The code is currently written in Python 3.3. I have researched a few GUI's for Python, namely Tkinter, wxPython and PyGTK. Everything I am finding…
Tennesseej
  • 379
  • 2
  • 3
  • 11
19
votes
2 answers

Using Pillow with Python 3

I'm not having much luck using Pillow with Python 3.3.2 and I'd be grateful for some help. My problem is that after installing Pillow, I can't import Image. My setup: I've got Linux Mint 16 installed (on an HP Pavilion dv7 laptop). I've got Python…
user198845
  • 571
  • 1
  • 4
  • 7
18
votes
1 answer

Does using virtualenvwrapper with Python3.3 mean I cannot (or should not) be using pyvenv?

Virtualenvwrapper is a user-friendly shell around Python's virtualenv. Python 3.3 ships with pyvenv built into the standard library, which aims to supercede virtualenv. But if I install Virtualenvwrapper on Python3.3, it still installs virtualenv,…
17
votes
5 answers

Python count items in dict value that is a list

Python 3.3, a dictionary with key-value pairs in this form. d = {'T1': ['eggs', 'bacon', 'sausage']} The values are lists of variable length, and I need to iterate over the list items. This works: count = 0 for l in d.values(): for i in l:…
RolfBly
  • 2,727
  • 4
  • 26
  • 38
16
votes
3 answers

Download a zip file and extract it in memory using Python3

I would like to download a zip file from internet and extract it. I would rather use requests. I don't want to write to the disk. I knew how to do that in Python2 but I am clueless for python3.3. Apparently, zipfile.Zipfile wants a file-like object…
user1720740
  • 798
  • 1
  • 6
  • 17
16
votes
3 answers

regex (vim) for print ... to print(...) for python2 to python3

This post is helpful only if you have strings inside of the print command. Now I have tons of sourcecode with a statement such as print milk,butter which should be formatted to print(milk,butter) And capturing the end of the line with \n was not…
varantir
  • 5,697
  • 5
  • 27
  • 50
16
votes
5 answers

Using bisect in a list of tuples?

I'm trying to figure out how to use bisect in a list of tuples for example [(3, 1), (2, 2), (5, 6)] How can I bisect this list according to the [1] in each tuple? list_dict [(69, 8), (70, 8), ((65, 67), 6)] tup1,tup2 (69, 8) (70, 8) list_dict…
user3157919
  • 163
  • 1
  • 5
15
votes
2 answers

Writing a .CSV file in Python that works for both Python 2.7+ and Python 3.3+ in Windows

EDIT: I put it in the title, but just realized I didn't mention it in the body. This seems to be specific to Windows. I'm having a hard time writing output using the csv Python module in a script that works with both Python 2.7 and 3.3. First try…
Tamerz
  • 848
  • 1
  • 9
  • 25
15
votes
2 answers

Meaning of end='' in the statement print("\t",end='')?

This is the function for printing all values in a nested list (taken from Head first with Python). def printall(the_list, level): for x in the_list: if isinstance(x, list): printall(x, level=level + 1) else: …
Rajath
  • 1,258
  • 2
  • 10
  • 18
15
votes
5 answers

Ubuntu - How to install a Python module (BeautifulSoup) on Python 3.3 instead of Python 2.7?

I have this code (as written in BS4 documentaion): from bs4 import BeautifulSoup When I run the script (using python3) I get the error: ImportError: No module named 'bs4' So installed BeatifulSoup by: sudo pip install BeatifulSoup4 But when…
dragonmnl
  • 11,330
  • 25
  • 71
  • 115
15
votes
5 answers

Printing subscript in python

In Python 3.3, is there any way to make a part of text in a string subscript when printed? e.g. H₂ (H and then a subscript 2)
samrobbins
  • 301
  • 2
  • 4
  • 10
15
votes
5 answers

Python sort() first element of list

I have a list that contains non specific amount of elements but every first element of the nested list is an identifier, I would like to use that identifier to sort the list in order list = [['D', 'F', 'E', 'D', 'F', 'D'],['A', 'F', 'E', 'C', 'F',…
DaveDave
  • 167
  • 1
  • 1
  • 7
1 2
3
77 78