You could just ignore the error data by try.. except.

self is not good name for regular parameter as it is normally used in oo programs for the instance itself.


rproffitt commented: Good idea about the "self" variable. +8

You have tagged various programming languages, but I do not get really your point, can you give specific question or your problem. Anything showing were you are stuck and we could advice you.

Here is bit more advanced version when you start to internalize the Python philosophy:

# Lets make it run with Python2
from __future__ import print_function

    input = raw_input

def acronym(phrase):
    return ''.join(word[0] for word in phrase.upper().split())

def main():
    print("This program creates an acronym for a phrase")
    print("entered by the user.")
    print(acronym(input("Please enter your phrase: ")))


Bit more interesting content decorator:

def print_it(func):
    def inner(*args):
        print(' '.join(func()))
        return func
    return inner

def my_func():
    return "Hello", "World"


Would we need New Hopefulls forum?

Considering your mathematical background, if you need some exercises after you got the basics and before tackling recoding your old code to Python (nice and very recommendable own project to push you to learn more), you might want to go through mathematical coding chalenges of the Project Euler

I am just youngster, started with MSBasic, Z80 Assembler and (Turbo) Pascal at 80's :)

I changed the snippet to code snippet and added call to main.

I think it is easy to choose subset of unicode letters (one special language specific letter from each letter set from each language specific letter set and special symbol set, for example, upto 256 set), that are unlikely to all occur in same document. And If you have one letter that does not occur in file, all sequences including that letter are not included in file, if you want longer non-occuring string.

Gribouillis commented: Yes but how to write it down ? +14

Here is example of minimum function with iterable and function to calculate distance:

from math import hypot
from functools import partial

def distance(p1, p2):
    return hypot(p2[1] - p1[1], p2[0] - p1[0])

points = [(81,3), (34, 32), (-4, 6)]

reference = (10,23)

print(min(points, key=partial(distance, reference)))
Gribouillis commented: I didn't know hypot() ! +14

I think in Python3 it is called zip_longest. I updated my code in original post.

Hi, double newlines seemed to work in Windows, but rotating the text turned out to be little more involved than I thought. I even had to revise my earlier rotation code to use izip_longest to deal with not square rotation of the character matrix.

    from itertools import izip_longest
except ImportError:
    # Python 3
    from itertools import zip_longest as izip_longest

def rot_right(a, fillvalue=None):
    return list(izip_longest(*a[::-1], fillvalue=fillvalue))

hello = dict(zip('helowrd'.upper(),'''
 *  *
 *  *
 *  *
 *  *
 *   *
 *   *
 *   *
*  *  *
*  *  *
*  *  *
 *  *
 *   *
 *  *
 *  *
 *   *
 *  *
 *  *
 *  *

hello[' '] = 5 * '     \n'
print('\n\n'.join(hello[c] for c in 'Hello world'.upper()))

for c in 'Hello world'.upper():
                    for data in rot_right(hello[c].split('\n'),
                                          fillvalue=' ')

print("Hello World")

Can anybody print out "Hello World" vertically?

print('\n'.join("Hello World"))

tkinter can not freeze as the code does not use tkinter. Show us clearly your question. What a coinsidence, that your code appears very similar to code in

I read this thread, and of course I would use the count method, but I got to make this task by yet another method and thought to share it.

def count(haystack, needle):
    return sum(haystack[n:].startswith(needle)
           for n in range(len(haystack) - len(needle) + 1))

print(count('assessement', 'as'))
# -> 1
print(count('assessement', 'sse'))
# -> 2
print(count('trans panamanian bananas', 'an')
# -> 6
Slavi commented: Nice one +5

How about

>>> 'tony veijalainen'.title()
'Tony Veijalainen'
>>> 'book of shadows'.title()
'Book Of Shadows'

Second one is not actually how it is done, but otherwise it is OK.

File is file,just attach whole file. It is receiver who opens the content, it does not matter except for the mime type.

pymotw is good place to learn about using modules. Here is the lesson on zipfile:

Also by example of the module you see that text of the message is input as preamble:

Also I believe that you should be reading the file as normal file (not zf) with read without parameters. The file would be previously zipped, so it would only be read as binary file and encoded with base64 (see last example end, else-part)

So change the zipfile part to normal open('', 'rb')

n & 1 returns the last bit of number, which is 1 for odd numbers (True like, e.g. 7 = 0b111) and 0 for even (e.g. 4 = 0b100)

Combinations, permutations etc can be found in itertools module.

You must use keyGen = KeyGenerator.my_generator_function() If my_generator_function is the function defined in the module KeyGenerator and it does not take any parameters.

It sounds that you are using statement KeyGenerator(....) which does not make sense.

If you want to suggest exercises for novice programmers, you can contribute to sticky thread started by vegaseat for that purpose.

If you want to ask question you need to provide proof of your efforts and specific question.

How is this connected with Python?'E:/Usuarios/Daniel/Documents/APNAE/QR/%s.jpeg' % nom)

Lambda expressions are not used so extensively and are kind of limitted in Python compared to functional programming like Lisp/Scheme. I would use simple basic expression, maybe list comprehension form:

[line for line in myfile if not line[0].isdigit()]

Do shallow copy of input list as list is mutable by slice [:] or .copy() method call.

You tried didn't you?

Despite the imports, the raw_input will not work in Python3. You must do assignment and decide which meaning to use. I normally assign raw_input to input in Python2.