Python HTMLParser and Vkontakte randomizer

Finally I’ve finish my first “program” on Python. The task is to parse people’s id from web page where reposter’s id stores. Main problems were: web-page code is loading dynamically so there is no simple way to get ids from it, the best solution was – save section where id stores in .html file I wanted to catch id + nickname but list of pairs was not a good decision when random works I can’t create a list which stores all found ids, it wiped every iteration I have some unsupported chars in nicknames and they’d broke iteration I’ve get a lot of junk while scan .html so I used regex to avoid them I can’t add various ids in list withoutShort Read more…

Python HTMLParser

How to spent two days if you know nothing about Python: need parse HTML page code, where VK id and username of every person who shared post stores  

Now I know more. First bug and first fix: UnicodeEncodeError: ‘charmap’ codec can’t encode character ‘\u0406’ in position 15: character maps to <undefined>

UPD2: I have found another one solution for this code, just re-thinking it’s logic. That way I use in vk = re.findall(‘/\S+$’, vk_id) can be simplified. I use vk_id = str(attrs) to convert list to string and then found there something matches regex. ! BUT I should just address to value from list ! example:

Will upgrade this section later.     Read more…

Plone installation

Will try to use Plone CMS for test cases, interesting to see what and how CMS on Python worked. Start here: For Python: Guide and I’ve use only one part from it here. I’ve done everything as guided above.

And Python lives here! Can have some troubles, like:

And this:

Be we can do a hardcore: (better do to it with this: ) Just adding all recommended settings which are: – path to installed and worked python 2.7 binaries, manually –with-python=/usr/local/bin/python2.7 – flag to allow Plone download needed dev modules and libraries –static-lxml=yes

I’m not guarantee that this method can save you from further pain with it – this is only my vision how to get busy. AfterShort Read more…

Заводим питончика дома или установка Python на Centos 6

Хороший гайд здесь: How to install Python 2.7.6 on CentOS 6.3 (6.2 and 6.4 okay too, probably others) stolen from Daniel Eriksson. Thanks Daniel! (modified a little) CentOS 6.2 ships with Python 2.6.6 and depends on that specific version. Be careful not to replace it or bad things will happen. If you need access to a newer version of Python you must compile it yourself and install it side-by-side with the system version. Here are the steps necessary to install Python 2.7.6. Execute all the commands below as root. Either log in as root temporarily or use sudo. Install development tools In order to compile Python you must first install the development tools:

You also need a fewShort Read more…

Python array

Начинаю учить Пайтон, буду набивать шпаргалки.

Это мой первый массив, детка. Спустя время, это может показаться для меня смешным, но сейчас я очень доволен собой. Read more…