Tags » Python

A Weird Python 3 Unicode Failure

The following code can fail on my system:

from os import listdir
for f in listdir(‘.’):

UnicodeEncodeError: ‘utf-8′ codec can’t encode character ‘\udce9′ in position 13: surrogates not allowed… 179 more words


Run, Python, run! Part 1: Timing your code

Sooner or later everyone comes to a realisation that one’s code is slow, too slow. Thankfully there were a lot of ‘everyone’ before us and they actually did something about it. 1,720 more words


First programming language - multiple languages anyone?

So most courses which teach introductory programming teach one language. Or at least they do now. Many years ago, before the 1980s, courses on introductory programming did not necessarily focus on any one particular language. 204 more words


Strange Python -- Command Line Arguments

When I am doing little bit mess around with Python , I’ve gone through command-line arguments.

So , Lets start!!!

Actually Command line arguments are pretty familiar things to us if we have programming knowledge , doesnt matter what language it is. 408 more words


Minecraft / Python apologies

My apologies to anyone following this blog hoping to try the Python programming examples. It appears that copying and pasting sections of codes works well if I enclose it correctly, but then the formatting gets messed up if I go back and edit the post. 80 more words


Python html2text adds random \n


You can disable the wrapping behavior by setting BODY_WIDTH to 0. Something like this:

import html2text
html2text.BODY_WIDTH = 0
text = html2text.html2text('...')

Of course, resetting BODY_WIDTH globally changes the module’s behavior. 36 more words


Greenstone Fractal

For some reason I couldn’t get this image to render in 3ds max after multiple attempts, so I had to recreate the model and set up the render again. 68 more words