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
-2
votes
2 answers

In Python i need a day_name function

A question I can't work out, is how to write a function day_name that converts an integer 0-6 into Sunday to Monday, 0 being Sunday. I found this helpful but the year and month confuse me = which day of week given a date python
-2
votes
1 answer

Shut down ubuntu with python

I'm making a program so that if the user enters a password in a python program incorrectly,it shuts down ubuntu. Example: >password=input() >>if password=="ThePassword": >>>print ("Welcome") >>>>else: >>>>>(shutdown code…
-2
votes
1 answer

application/json formatted post-request in python3

DOWNVOTERS: leave a comment with some constructive critisism! I have no fkn clue what is wrong with this question. How do I make a POST-request in python3? I'm trying to fetch google plus ones for some url's the common but unofficial way through…
Filip Haglund
  • 13,919
  • 13
  • 64
  • 113
-2
votes
1 answer

How to add a string into a class?

Let's say I have a Patron class that has the instance variables: name, patron_id and borroweds(borrowed books). This pretty much is a class for a virtual library. if one of my functions requires me to take a book_id # which is a string and to…
user2976821
  • 353
  • 1
  • 3
  • 8
-2
votes
1 answer

How to find the co shortest and co longest word in dictionary

I'm trying to find the co shortest words and co longest words in a given dictionary with the keys being the words. When I sort the dictionary, my code below doesn't do that. I get "And" for shorts and "yours" for longs. What is the problem? def…
user2976821
  • 353
  • 1
  • 3
  • 8
-2
votes
3 answers

Python 3.3 Hello program

# This program says hello and asks for my name. print('Hello world!') print('What is your name?') myName = input() for Name in myName (1,10): print('It is nice to meet you, ' + myName) I was asked to create a program that uses a for loop…
iExodus
  • 11
  • 1
  • 1
  • 4
-2
votes
3 answers

Python file to list

So I have file: Ben cat 15 John dog 17 Harry hamster 3 How to make 3 lists: [Ben, John, Harry] [cat, dog, hamster] [15, 17, 3] I have tried everything, but I haven't find a solution yet. I am using Python 3.3.0
-3
votes
1 answer

what do i do as it keeps saying syntax error

I have some code that keeps saying syntax error please help. count = 0 output = [] encoded = [] keylist = [] stringlist = [] alphabet = [ "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v",…
fastwise6
  • 1
  • 1
-3
votes
2 answers

How to create a .txt file in python by the user prefered nsme?

I have made a program tht reads the stored file details. I want to create a .txt file using python tkinter .the name of the creating file will be given by user in entry box. Can you provide the correct code.please
-3
votes
1 answer

Invalid syntax for except ValueError

When i run this code (Python 3.3): counter=0 score=0 import random a = random.randint(1,25) b = random.randint(1,25) c=a+b try: answer=int(input("What is "+str(a)+" + "+str(b)+" ? ") if answer == c: score=score+1 …
jimmy123
  • 3
  • 2
-3
votes
1 answer

defining dollar and being allowed to make that a float in python

Hey sorry if the title was misleading but for my assignment for the week I must make a program that converts dollars to pounds which is easy however I cannot seem to figure out how to input a dollar sign with my code then do addition with it since…
Dan Todorovic'
  • 67
  • 1
  • 1
  • 5
-3
votes
2 answers

how can i display my sentence in python 3.3?

how can i display a sentence in the my program .. if i have this sentence: " i play football" and i want to replace a letter "o" for example with "e".... i do that with the following code and that code Displays the Adjustments that it did on the…
Ibrahim
  • 9
  • 4
-3
votes
3 answers

How to create a variable with code (Python)

So I have this platformer game. I need a variable creator. It's hard to explain. Here's the code... import pygame,time,random,sys pygame.display.set_caption('My Platformer V1.0') x = 10 y = 30 import os os.environ['SDL_VIDEO_WINDOW_POS'] = "%d,%d" %…
Larry McMuffin
  • 229
  • 3
  • 12
-3
votes
2 answers

How to alternate between two players?

I was wondering if anyone had any ideas on how to alternate between two players until a specific condition has been met? I had while statements in mind but I'm not sure if I can actually put it into practise. Any ideas would be appreciated!
monkey334
  • 327
  • 2
  • 8
  • 23
-3
votes
4 answers

How to install Cocos2d (Python) into Python 3.3?

I am trying to use Python 3.3 when developing my next game using Cocos2d. I succeeded in installing Pyglet (a Cocos2d dependency) in Python 3.3 but failed to do so for Cocos2d. The Cocos2d project page lists Python 2.6 as a requirement, but from…
swdev
  • 4,997
  • 8
  • 64
  • 106