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.

1148 questions
23
votes
4 answers

How do I compile my Python 3 app to an .exe?

How do I convert my Python app to a .exe? I made a program with tkinter and was wondering how to make it possible for others to use. I use Python 3.3. I searched for a bit but could not find anything.
Sam Chahine
  • 530
  • 1
  • 17
  • 52
22
votes
6 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
  • 231
  • 1
  • 2
  • 5
22
votes
2 answers

SyntaxError: unexpected EOF while parsing

I have no idea why this does not work please help import random x = 0 z = input('?') int(z) def main(): while x < z: n1 = random.randrange(1,3) n2 = random.randrange(1,3) t1 = n1+n2 …
Quar
  • 369
  • 3
  • 4
  • 10
22
votes
5 answers

Installing pip for python3.3

I downloaded pip from Package Index > pip 1.2.1 Then I installed it using sudo python3.3 setup.py install Still, when I try to use pip-3.3 the terminal complains -bash: pip-3.3: command not found However, pip-2.7 works swimmingly. I have also…
The Unfun Cat
  • 29,987
  • 31
  • 114
  • 156
21
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
  • 14,578
  • 33
  • 84
  • 129
21
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
  • 399
  • 2
  • 3
  • 11
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
  • 333
  • 1
  • 3
  • 8
20
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
  • 601
  • 1
  • 5
  • 7
19
votes
5 answers

'str' object has no attribute 'decode' in Python 3

I've some problem with decode method in python 3.3.4. This is my code: for line in open('file','r'): decodedLine = line.decode('ISO-8859-1') line = decodedLine.split('\t') But I can't decode the line for this problem: AttributeError: 'str'…
hasmet
  • 758
  • 3
  • 13
  • 32
19
votes
3 answers

Removing everything except letters and spaces from string in Python3.3

I have this example string: happy t00 go 129.129 and I want to keep only the spaces and letters. All I have been able to come up with so far that is pretty efficient is: print(re.sub("\d", "", 'happy t00 go 129.129'.replace('.', ''))) but it is…
Gronk
  • 381
  • 1
  • 3
  • 12
18
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
  • 848
  • 1
  • 7
  • 17
18
votes
2 answers

Replace the content of dictionary with another dictionary in a function - Python

I have a dictionary, and I want to pass it as argument to a function. After executing this function, I want the dictionary changed. Here is my try: def func(dict): dict = {'a': 5} So what I want to happen: dict = {'b': 3} func(dict) print(dict)…
Faery
  • 4,552
  • 10
  • 50
  • 92
18
votes
3 answers

A ThreadPoolExecutor inside a ProcessPoolExecutor

I am new to the futures module and have a task that could benefit from parallelization; but I don't seem to be able to figure out exactly how to setup the function for a thread and the function for a process. I'd appreciate any help anyone can shed…
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,…
18
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
  • 3,612
  • 5
  • 32
  • 46
1 2
3
76 77